Fabcoin Core  0.16.2
P2P Digital Currency
ClientBase.cpp
Go to the documentation of this file.
1 /*
2  This file is part of cpp-ethereum.
3 
4  cpp-ethereum is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  cpp-ethereum is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
16  */
23 #include "ClientBase.h"
24 #include <algorithm>
25 #include "BlockChain.h"
26 #include "Executive.h"
27 #include "State.h"
28 
29 using namespace std;
30 using namespace dev;
31 using namespace dev::eth;
32 
33 const char* WatchChannel::name() { return EthBlue "ℹ" EthWhite " "; }
34 const char* WorkInChannel::name() { return EthOrange "⚒" EthGreen "▬▶"; }
35 const char* WorkOutChannel::name() { return EthOrange "⚒" EthNavy "◀▬"; }
36 const char* WorkChannel::name() { return EthOrange "⚒" EthWhite " "; }
37 
38 static const int64_t c_maxGasEstimate = 50000000;
39 
40 pair<h256, Address> ClientBase::submitTransaction(TransactionSkeleton const& _t, Secret const& _secret)
41 {
42  prepareForTransaction();
43 
44  TransactionSkeleton ts(_t);
45  ts.from = toAddress(_secret);
46  if (_t.nonce == Invalid256)
47  ts.nonce = max<u256>(postSeal().transactionsFrom(ts.from), m_tq.maxNonce(ts.from));
48  if (ts.gasPrice == Invalid256)
49  ts.gasPrice = gasBidPrice();
50  if (ts.gas == Invalid256)
51  ts.gas = min<u256>(gasLimitRemaining() / 5, balanceAt(ts.from) / ts.gasPrice);
52 
53  Transaction t(ts, _secret);
54  m_tq.import(t.rlp());
55 
56  return make_pair(t.sha3(), toAddress(ts.from, ts.nonce));
57 }
58 
59 // TODO: remove try/catch, allow exceptions
60 ExecutionResult ClientBase::call(Address const& _from, u256 _value, Address _dest, bytes const& _data, u256 _gas, u256 _gasPrice, BlockNumber _blockNumber, FudgeFactor _ff)
61 {
62  ExecutionResult ret;
63  try
64  {
65  Block temp = block(_blockNumber);
66  u256 nonce = max<u256>(temp.transactionsFrom(_from), m_tq.maxNonce(_from));
67  u256 gas = _gas == Invalid256 ? gasLimitRemaining() : _gas;
68  u256 gasPrice = _gasPrice == Invalid256 ? gasBidPrice() : _gasPrice;
69  Transaction t(_value, gasPrice, gas, _dest, _data, nonce);
70  t.forceSender(_from);
71  if (_ff == FudgeFactor::Lenient)
72  temp.mutableState().addBalance(_from, (u256)(t.gas() * t.gasPrice() + t.value()));
73  ret = temp.execute(bc().lastHashes(), t, Permanence::Reverted);
74  }
75  catch (...)
76  {
77  // TODO: Some sort of notification of failure.
78  }
79  return ret;
80 }
81 
82 ExecutionResult ClientBase::create(Address const& _from, u256 _value, bytes const& _data, u256 _gas, u256 _gasPrice, BlockNumber _blockNumber, FudgeFactor _ff)
83 {
84  ExecutionResult ret;
85  try
86  {
87  Block temp = block(_blockNumber);
88  u256 n = temp.transactionsFrom(_from);
89  // cdebug << "Nonce at " << toAddress(_secret) << " pre:" << m_preSeal.transactionsFrom(toAddress(_secret)) << " post:" << m_postSeal.transactionsFrom(toAddress(_secret));
90  Transaction t(_value, _gasPrice, _gas, _data, n);
91  t.forceSender(_from);
92  if (_ff == FudgeFactor::Lenient)
93  temp.mutableState().addBalance(_from, (u256)(t.gas() * t.gasPrice() + t.value()));
94  ret = temp.execute(bc().lastHashes(), t, Permanence::Reverted);
95  }
96  catch (...)
97  {
98  // TODO: Some sort of notification of failure.
99  }
100  return ret;
101 }
102 
103 std::pair<u256, ExecutionResult> ClientBase::estimateGas(Address const& _from, u256 _value, Address _dest, bytes const& _data, int64_t _maxGas, u256 _gasPrice, BlockNumber _blockNumber, GasEstimationCallback const& _callback)
104 {
105  try
106  {
107  int64_t upperBound = _maxGas;
108  if (upperBound == Invalid256 || upperBound > c_maxGasEstimate)
109  upperBound = c_maxGasEstimate;
110  int64_t lowerBound = Transaction::baseGasRequired(!_dest, &_data, EVMSchedule());
111  Block bk = block(_blockNumber);
112  u256 gasPrice = _gasPrice == Invalid256 ? gasBidPrice() : _gasPrice;
113  ExecutionResult er;
114  ExecutionResult lastGood;
115  bool good = false;
116  while (upperBound != lowerBound)
117  {
118  int64_t mid = (lowerBound + upperBound) / 2;
119  u256 n = bk.transactionsFrom(_from);
120  Transaction t;
121  if (_dest)
122  t = Transaction(_value, gasPrice, mid, _dest, _data, n);
123  else
124  t = Transaction(_value, gasPrice, mid, _data, n);
125  t.forceSender(_from);
126  EnvInfo env(bk.info(), bc().lastHashes(), 0);
127  env.setGasLimit(mid);
128  State tempState(bk.state());
129  tempState.addBalance(_from, (u256)(t.gas() * t.gasPrice() + t.value()));
130  er = tempState.execute(env, *bc().sealEngine(), t, Permanence::Reverted).first;
131  if (er.excepted == TransactionException::OutOfGas ||
132  er.excepted == TransactionException::OutOfGasBase ||
133  er.excepted == TransactionException::OutOfGasIntrinsic ||
134  er.codeDeposit == CodeDeposit::Failed ||
135  er.excepted == TransactionException::BadJumpDestination)
136  lowerBound = lowerBound == mid ? upperBound : mid;
137  else
138  {
139  lastGood = er;
140  upperBound = upperBound == mid ? lowerBound : mid;
141  good = true;
142  }
143 
144  if (_callback)
145  _callback(GasEstimationProgress { lowerBound, upperBound });
146  }
147  if (_callback)
148  _callback(GasEstimationProgress { lowerBound, upperBound });
149  return make_pair(upperBound, good ? lastGood : er);
150  }
151  catch (...)
152  {
153  // TODO: Some sort of notification of failure.
154  return make_pair(u256(), ExecutionResult());
155  }
156 }
157 
158 ImportResult ClientBase::injectBlock(bytes const& _block)
159 {
160  return bc().attemptImport(_block, preSeal().db()).first;
161 }
162 
163 u256 ClientBase::balanceAt(Address _a, BlockNumber _block) const
164 {
165  return block(_block).balance(_a);
166 }
167 
168 u256 ClientBase::countAt(Address _a, BlockNumber _block) const
169 {
170  return block(_block).transactionsFrom(_a);
171 }
172 
173 u256 ClientBase::stateAt(Address _a, u256 _l, BlockNumber _block) const
174 {
175  return block(_block).storage(_a, _l);
176 }
177 
178 h256 ClientBase::stateRootAt(Address _a, BlockNumber _block) const
179 {
180  return block(_block).storageRoot(_a);
181 }
182 
183 bytes ClientBase::codeAt(Address _a, BlockNumber _block) const
184 {
185  return block(_block).code(_a);
186 }
187 
188 h256 ClientBase::codeHashAt(Address _a, BlockNumber _block) const
189 {
190  return block(_block).codeHash(_a);
191 }
192 
193 map<h256, pair<u256, u256>> ClientBase::storageAt(Address _a, BlockNumber _block) const
194 {
195  return block(_block).storage(_a);
196 }
197 
198 // TODO: remove try/catch, allow exceptions
199 LocalisedLogEntries ClientBase::logs(unsigned _watchId) const
200 {
201  LogFilter f;
202  try
203  {
204  Guard l(x_filtersWatches);
205  f = m_filters.at(m_watches.at(_watchId).id).filter;
206  }
207  catch (...)
208  {
209  return LocalisedLogEntries();
210  }
211  return logs(f);
212 }
213 
214 LocalisedLogEntries ClientBase::logs(LogFilter const& _f) const
215 {
217  unsigned begin = min(bc().number() + 1, (unsigned)numberFromHash(_f.latest()));
218  unsigned end = min(bc().number(), min(begin, (unsigned)numberFromHash(_f.earliest())));
219 
220  // Handle pending transactions differently as they're not on the block chain.
221  if (begin > bc().number())
222  {
223  Block temp = postSeal();
224  for (unsigned i = 0; i < temp.pending().size(); ++i)
225  {
226  // Might have a transaction that contains a matching log.
227  TransactionReceipt const& tr = temp.receipt(i);
228  LogEntries le = _f.matches(tr);
229  for (unsigned j = 0; j < le.size(); ++j)
230  ret.insert(ret.begin(), LocalisedLogEntry(le[j]));
231  }
232  begin = bc().number();
233  }
234 
235  // Handle reverted blocks
236  // There are not so many, so let's iterate over them
237  h256s blocks;
238  h256 ancestor;
239  unsigned ancestorIndex;
240  tie(blocks, ancestor, ancestorIndex) = bc().treeRoute(_f.earliest(), _f.latest(), false);
241 
242  for (size_t i = 0; i < ancestorIndex; i++)
243  prependLogsFromBlock(_f, blocks[i], BlockPolarity::Dead, ret);
244 
245  // cause end is our earliest block, let's compare it with our ancestor
246  // if ancestor is smaller let's move our end to it
247  // example:
248  //
249  // 3b -> 2b -> 1b
250  // -> g
251  // 3a -> 2a -> 1a
252  //
253  // if earliest is at 2a and latest is a 3b, coverting them to numbers
254  // will give us pair (2, 3)
255  // and we want to get all logs from 1 (ancestor + 1) to 3
256  // so we have to move 2a to g + 1
257  end = min(end, (unsigned)numberFromHash(ancestor) + 1);
258 
259  // Handle blocks from main chain
260  set<unsigned> matchingBlocks;
261  if (!_f.isRangeFilter())
262  for (auto const& i: _f.bloomPossibilities())
263  for (auto u: bc().withBlockBloom(i, end, begin))
264  matchingBlocks.insert(u);
265  else
266  // if it is a range filter, we want to get all logs from all blocks in given range
267  for (unsigned i = end; i <= begin; i++)
268  matchingBlocks.insert(i);
269 
270  for (auto n: matchingBlocks)
271  prependLogsFromBlock(_f, bc().numberHash(n), BlockPolarity::Live, ret);
272 
273  reverse(ret.begin(), ret.end());
274  return ret;
275 }
276 
277 void ClientBase::prependLogsFromBlock(LogFilter const& _f, h256 const& _blockHash, BlockPolarity _polarity, LocalisedLogEntries& io_logs) const
278 {
279  auto receipts = bc().receipts(_blockHash).receipts;
280  for (size_t i = 0; i < receipts.size(); i++)
281  {
282  TransactionReceipt receipt = receipts[i];
283  auto th = transaction(_blockHash, i).sha3();
284  LogEntries le = _f.matches(receipt);
285  for (unsigned j = 0; j < le.size(); ++j)
286  io_logs.insert(io_logs.begin(), LocalisedLogEntry(le[j], _blockHash, (BlockNumber)bc().number(_blockHash), th, i, 0, _polarity));
287  }
288 }
289 
290 unsigned ClientBase::installWatch(LogFilter const& _f, Reaping _r)
291 {
292  h256 h = _f.sha3();
293  {
294  Guard l(x_filtersWatches);
295  if (!m_filters.count(h))
296  {
297  cwatch << "FFF" << _f << h;
298  m_filters.insert(make_pair(h, _f));
299  }
300  }
301  return installWatch(h, _r);
302 }
303 
304 unsigned ClientBase::installWatch(h256 _h, Reaping _r)
305 {
306  unsigned ret;
307  {
308  Guard l(x_filtersWatches);
309  ret = m_watches.size() ? m_watches.rbegin()->first + 1 : 0;
310  m_watches[ret] = ClientWatch(_h, _r);
311  cwatch << "+++" << ret << _h;
312  }
313 #if INITIAL_STATE_AS_CHANGES
314  auto ch = logs(ret);
315  if (ch.empty())
316  ch.push_back(InitialChange);
317  {
318  Guard l(x_filtersWatches);
319  swap(m_watches[ret].changes, ch);
320  }
321 #endif
322  return ret;
323 }
324 
325 bool ClientBase::uninstallWatch(unsigned _i)
326 {
327  cwatch << "XXX" << _i;
328 
329  Guard l(x_filtersWatches);
330 
331  auto it = m_watches.find(_i);
332  if (it == m_watches.end())
333  return false;
334  auto id = it->second.id;
335  m_watches.erase(it);
336 
337  auto fit = m_filters.find(id);
338  if (fit != m_filters.end())
339  if (!--fit->second.refCount)
340  {
341  cwatch << "*X*" << fit->first << ":" << fit->second.filter;
342  m_filters.erase(fit);
343  }
344  return true;
345 }
346 
347 LocalisedLogEntries ClientBase::peekWatch(unsigned _watchId) const
348 {
349  Guard l(x_filtersWatches);
350 
351 // cwatch << "peekWatch" << _watchId;
352  auto& w = m_watches.at(_watchId);
353 // cwatch << "lastPoll updated to " << chrono::duration_cast<chrono::seconds>(chrono::system_clock::now().time_since_epoch()).count();
354  if (w.lastPoll != chrono::system_clock::time_point::max())
355  w.lastPoll = chrono::system_clock::now();
356  return w.changes;
357 }
358 
359 LocalisedLogEntries ClientBase::checkWatch(unsigned _watchId)
360 {
361  Guard l(x_filtersWatches);
363 
364 // cwatch << "checkWatch" << _watchId;
365  auto& w = m_watches.at(_watchId);
366 // cwatch << "lastPoll updated to " << chrono::duration_cast<chrono::seconds>(chrono::system_clock::now().time_since_epoch()).count();
367  std::swap(ret, w.changes);
368  if (w.lastPoll != chrono::system_clock::time_point::max())
369  w.lastPoll = chrono::system_clock::now();
370 
371  return ret;
372 }
373 
374 BlockHeader ClientBase::blockInfo(h256 _hash) const
375 {
376  if (_hash == PendingBlockHash)
377  return preSeal().info();
378  return BlockHeader(bc().block(_hash));
379 }
380 
381 BlockDetails ClientBase::blockDetails(h256 _hash) const
382 {
383  return bc().details(_hash);
384 }
385 
386 Transaction ClientBase::transaction(h256 _transactionHash) const
387 {
388  return Transaction(bc().transaction(_transactionHash), CheckTransaction::Cheap);
389 }
390 
391 LocalisedTransaction ClientBase::localisedTransaction(h256 const& _transactionHash) const
392 {
393  std::pair<h256, unsigned> tl = bc().transactionLocation(_transactionHash);
394  return localisedTransaction(tl.first, tl.second);
395 }
396 
397 Transaction ClientBase::transaction(h256 _blockHash, unsigned _i) const
398 {
399  auto bl = bc().block(_blockHash);
400  RLP b(bl);
401  if (_i < b[1].itemCount())
402  return Transaction(b[1][_i].data(), CheckTransaction::Cheap);
403  else
404  return Transaction();
405 }
406 
407 LocalisedTransaction ClientBase::localisedTransaction(h256 const& _blockHash, unsigned _i) const
408 {
409  Transaction t = Transaction(bc().transaction(_blockHash, _i), CheckTransaction::Cheap);
410  return LocalisedTransaction(t, _blockHash, _i, numberFromHash(_blockHash));
411 }
412 
413 TransactionReceipt ClientBase::transactionReceipt(h256 const& _transactionHash) const
414 {
415  return bc().transactionReceipt(_transactionHash);
416 }
417 
418 LocalisedTransactionReceipt ClientBase::localisedTransactionReceipt(h256 const& _transactionHash) const
419 {
420  std::pair<h256, unsigned> tl = bc().transactionLocation(_transactionHash);
421  Transaction t = Transaction(bc().transaction(tl.first, tl.second), CheckTransaction::Cheap);
422  TransactionReceipt tr = bc().transactionReceipt(tl.first, tl.second);
424  tr,
425  t.sha3(),
426  tl.first,
427  numberFromHash(tl.first),
428  tl.second,
429  toAddress(t.from(), t.nonce()));
430 }
431 
432 pair<h256, unsigned> ClientBase::transactionLocation(h256 const& _transactionHash) const
433 {
434  return bc().transactionLocation(_transactionHash);
435 }
436 
437 Transactions ClientBase::transactions(h256 _blockHash) const
438 {
439  auto bl = bc().block(_blockHash);
440  RLP b(bl);
441  Transactions res;
442  for (unsigned i = 0; i < b[1].itemCount(); i++)
443  res.emplace_back(b[1][i].data(), CheckTransaction::Cheap);
444  return res;
445 }
446 
447 TransactionHashes ClientBase::transactionHashes(h256 _blockHash) const
448 {
449  return bc().transactionHashes(_blockHash);
450 }
451 
452 BlockHeader ClientBase::uncle(h256 _blockHash, unsigned _i) const
453 {
454  auto bl = bc().block(_blockHash);
455  RLP b(bl);
456  if (_i < b[2].itemCount())
457  return BlockHeader(b[2][_i].data(), HeaderData);
458  else
459  return BlockHeader();
460 }
461 
462 UncleHashes ClientBase::uncleHashes(h256 _blockHash) const
463 {
464  return bc().uncleHashes(_blockHash);
465 }
466 
467 unsigned ClientBase::transactionCount(h256 _blockHash) const
468 {
469  auto bl = bc().block(_blockHash);
470  RLP b(bl);
471  return b[1].itemCount();
472 }
473 
474 unsigned ClientBase::uncleCount(h256 _blockHash) const
475 {
476  auto bl = bc().block(_blockHash);
477  RLP b(bl);
478  return b[2].itemCount();
479 }
480 
481 unsigned ClientBase::number() const
482 {
483  return bc().number();
484 }
485 
486 Transactions ClientBase::pending() const
487 {
488  return postSeal().pending();
489 }
490 
491 h256s ClientBase::pendingHashes() const
492 {
493  return h256s() + postSeal().pendingHashes();
494 }
495 
496 BlockHeader ClientBase::pendingInfo() const
497 {
498  return postSeal().info();
499 }
500 
501 BlockDetails ClientBase::pendingDetails() const
502 {
503  auto pm = postSeal().info();
504  auto li = Interface::blockDetails(LatestBlock);
505  return BlockDetails((unsigned)pm.number(), li.totalDifficulty + pm.difficulty(), pm.parentHash(), h256s{});
506 }
507 
508 Addresses ClientBase::addresses(BlockNumber _block) const
509 {
510  Addresses ret;
511  for (auto const& i: block(_block).addresses())
512  ret.push_back(i.first);
513  return ret;
514 }
515 
516 u256 ClientBase::gasLimitRemaining() const
517 {
518  return postSeal().gasLimitRemaining();
519 }
520 
521 Address ClientBase::author() const
522 {
523  return preSeal().author();
524 }
525 
526 h256 ClientBase::hashFromNumber(BlockNumber _number) const
527 {
528  if (_number == PendingBlock)
529  return h256();
530  if (_number == LatestBlock)
531  return bc().currentHash();
532  return bc().numberHash(_number);
533 }
534 
535 BlockNumber ClientBase::numberFromHash(h256 _blockHash) const
536 {
537  if (_blockHash == PendingBlockHash)
538  return bc().number() + 1;
539  else if (_blockHash == LatestBlockHash)
540  return bc().number();
541  else if (_blockHash == EarliestBlockHash)
542  return 0;
543  return bc().number(_blockHash);
544 }
545 
546 int ClientBase::compareBlockHashes(h256 _h1, h256 _h2) const
547 {
548  BlockNumber n1 = numberFromHash(_h1);
549  BlockNumber n2 = numberFromHash(_h2);
550 
551  if (n1 > n2)
552  return 1;
553  else if (n1 == n2)
554  return 0;
555  return -1;
556 }
557 
558 bool ClientBase::isKnown(h256 const& _hash) const
559 {
560  return _hash == PendingBlockHash ||
561  _hash == LatestBlockHash ||
562  _hash == EarliestBlockHash ||
563  bc().isKnown(_hash);
564 }
565 
566 bool ClientBase::isKnown(BlockNumber _block) const
567 {
568  return _block == PendingBlock ||
569  _block == LatestBlock ||
570  bc().numberHash(_block) != h256();
571 }
572 
573 bool ClientBase::isKnownTransaction(h256 const& _transactionHash) const
574 {
575  return bc().isKnownTransaction(_transactionHash);
576 }
577 
578 bool ClientBase::isKnownTransaction(h256 const& _blockHash, unsigned _i) const
579 {
580  return isKnown(_blockHash) && block(_blockHash).pending().size() > _i;
581 }
582 
583 Block ClientBase::block(BlockNumber _h) const
584 {
585  if (_h == PendingBlock)
586  return postSeal();
587  else if (_h == LatestBlock)
588  return preSeal();
589  return block(bc().numberHash(_h));
590 }
CodeDeposit codeDeposit
Failed if an attempted deposit failed due to lack of gas.
Definition: Transaction.h:75
bool matches(LogBloom _bloom) const
Definition: LogFilter.cpp:61
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
State const & state() const
Get the backing state object.
Definition: Block.h:163
Address from() const
Synonym for safeSender().
Definition: Transaction.h:128
h256s TransactionHashes
Definition: BlockChain.h:81
void swap(dev::eth::Watch &_a, dev::eth::Watch &_b)
Definition: Interface.h:284
bytesConstRef data() const
The bare data of the RLP.
Definition: RLP.h:97
size_t itemCount() const
Definition: RLP.h:118
Encapsulation of a block header.
Definition: BlockHeader.h:95
#define h(i)
Definition: sha.cpp:736
std::vector< Transaction > Transactions
Nice name for vector of Transaction.
Definition: Transaction.h:121
#define EthGreen
Definition: Terminal.h:122
std::hash for asio::adress
Definition: Common.h:323
u256 transactionsFrom(Address const &_address) const
Get the number of transactions a particular address has sent (used for the transaction nonce)...
Definition: Block.h:132
#define EthOrange
Definition: Terminal.h:124
void setGasLimit(int64_t _v)
Definition: ExtVMFace.h:249
ExecStats::duration min
Definition: ExecStats.cpp:35
Description of the result of executing a transaction.
Definition: Transaction.h:69
Model of an Ethereum state, essentially a facade for the trie.
Definition: State.h:161
unsigned BlockNumber
Definition: Common.h:72
TransactionReceipt const & receipt(unsigned _i) const
Get the transaction receipt for the transaction of the given index.
Definition: Block.h:194
std::vector< LocalisedLogEntry > LocalisedLogEntries
Definition: ExtVMFace.h:156
h256 latest() const
hash of latest block which should be filtered
Definition: LogFilter.h:62
h256s UncleHashes
Definition: BlockChain.h:82
ImportResult
Definition: Common.h:97
Active model of a block within the block chain.
Definition: Block.h:73
std::lock_guard< std::mutex > Guard
Definition: Guards.h:41
BlockPolarity
Definition: ExtVMFace.h:81
const char * name
Definition: rest.cpp:36
ExecStats::duration max
Definition: ExecStats.cpp:36
#define EthWhite
Definition: Terminal.h:119
std::vector< byte > bytes
Definition: Common.h:75
h256 earliest() const
hash of earliest block which should be filtered
Definition: LogFilter.h:59
const u256 Invalid256
Definition: Common.cpp:38
Fixed-size raw-byte array container type, with an API optimised for storing hashes.
Definition: FixedHash.h:47
h256 sha3(IncludeSignature _sig=WithSignature) const
FixedHash< 32 > h256
Definition: FixedHash.h:340
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
Definition: Common.h:125
h160s Addresses
A vector of Ethereum addresses.
Definition: Common.h:68
Transactions const & pending() const
Get the list of pending transactions.
Definition: Block.h:188
Encodes a transaction, ready to be exported to or freshly imported from RLP.
Definition: Transaction.h:84
Address toAddress(Public const &_public)
Convert a public key to address.
Definition: Common.cpp:87
TransactionException excepted
Definition: Transaction.h:72
#define b(i, j)
#define cwatch
Definition: ClientBase.h:68
#define f(x)
Definition: gost.cpp:57
std::function< void(GasEstimationProgress const &)> GasEstimationCallback
Definition: Interface.h:62
State & mutableState()
Get a mutable State object which is backing this block.
Definition: Block.h:180
#define EthNavy
Definition: Terminal.h:126
LastHashes lastHashes(u256 _currentBlockNumber)
Definition: TestHelper.cpp:544
void forceSender(Address const &_a)
Force the sender to a particular value. This will result in an invalid transaction RLP...
Definition: Transaction.h:87
virtual void addBalance(Address const &_id, u256 const &_amount)
Add some amount to balance.
Definition: State.cpp:286
h256 sha3() const
Definition: LogFilter.cpp:42
Definition: ExtVMFace.h:112
ExecutionResult execute(LastHashes const &_lh, Transaction const &_t, Permanence _p=Permanence::Committed, OnOpFunc const &_onOp=OnOpFunc())
Execute a given transaction.
Definition: Block.cpp:649
bool isRangeFilter() const
Range filter is a filter which doesn&#39;t care about addresses or topics Matches are all entries from ea...
Definition: LogFilter.cpp:49
#define EthBlue
Definition: Terminal.h:127
std::vector< h256 > h256s
Definition: FixedHash.h:345
uint32_t ch(uint32_t x, uint32_t y, uint32_t z)
Definition: picosha2.h:73
uint8_t const * data
Definition: sha3.h:19
Class for interpreting Recursive Linear-Prefix Data.
Definition: RLP.h:64
BlockHeader const & info() const
Get the header information on the present block.
Definition: Block.h:279
std::vector< LogEntry > LogEntries
Definition: ExtVMFace.h:110
std::vector< LogBloom > bloomPossibilities() const
Definition: LogFilter.cpp:88