Fabcoin Core  0.16.2
P2P Digital Currency
BlockChain.h
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 */
22 #pragma once
23 
24 #include <deque>
25 #include <chrono>
26 #include <unordered_map>
27 #include <unordered_set>
28 #include <libdevcore/db.h>
29 #include <libdevcore/Log.h>
30 #include <libdevcore/Exceptions.h>
31 #include <libdevcore/Guards.h>
32 #include <libethcore/Common.h>
33 #include <libethcore/BlockHeader.h>
34 #include <libethcore/SealEngine.h>
35 #include <libevm/ExtVMFace.h>
36 #include "BlockDetails.h"
37 #include "Account.h"
38 #include "Transaction.h"
39 #include "BlockQueue.h"
40 #include "VerifiedBlock.h"
41 #include "ChainParams.h"
42 #include "State.h"
43 
44 namespace std
45 {
46 template <> struct hash<pair<dev::h256, unsigned>>
47 {
48  size_t operator()(pair<dev::h256, unsigned> const& _x) const { return hash<dev::h256>()(_x.first) ^ hash<unsigned>()(_x.second); }
49 };
50 }
51 
52 namespace dev
53 {
54 
55 class OverlayDB;
56 
57 namespace eth
58 {
59 
60 static const h256s NullH256s;
61 
62 class State;
63 class Block;
64 
65 DEV_SIMPLE_EXCEPTION(AlreadyHaveBlock);
66 DEV_SIMPLE_EXCEPTION(FutureTime);
67 DEV_SIMPLE_EXCEPTION(TransientError);
68 
69 struct BlockChainChat: public LogChannel { static const char* name(); static const int verbosity = 5; };
70 struct BlockChainNote: public LogChannel { static const char* name(); static const int verbosity = 3; };
71 struct BlockChainWarn: public LogChannel { static const char* name(); static const int verbosity = 1; };
72 struct BlockChainDebug: public LogChannel { static const char* name(); static const int verbosity = 0; };
73 
74 // TODO: Move all this Genesis stuff into Genesis.h/.cpp
75 std::unordered_map<Address, Account> const& genesisState();
76 
77 ldb::Slice toSlice(h256 const& _h, unsigned _sub = 0);
78 ldb::Slice toSlice(uint64_t _n, unsigned _sub = 0);
79 
80 using BlocksHash = std::unordered_map<h256, bytes>;
83 
84 enum {
91 };
92 
93 using ProgressCallback = std::function<void(unsigned, unsigned)>;
94 
96 {
97 public:
98  VersionChecker(std::string const& _dbPath, h256 const& _genesisHash);
99 };
100 
106 {
107 public:
110  BlockChain(ChainParams const& _p, std::string const& _path, WithExisting _we = WithExisting::Trust, ProgressCallback const& _pc = ProgressCallback());
111  ~BlockChain();
112 
114  void reopen(WithExisting _we = WithExisting::Trust, ProgressCallback const& _pc = ProgressCallback()) { reopen(m_params, _we, _pc); }
115  void reopen(ChainParams const& _p, WithExisting _we = WithExisting::Trust, ProgressCallback const& _pc = ProgressCallback());
116 
119  void process();
120 
123  std::tuple<ImportRoute, bool, unsigned> sync(BlockQueue& _bq, OverlayDB const& _stateDB, unsigned _max);
124 
127  std::pair<ImportResult, ImportRoute> attemptImport(bytes const& _block, OverlayDB const& _stateDB, bool _mutBeNew = true) noexcept;
128 
131  ImportRoute import(bytes const& _block, OverlayDB const& _stateDB, bool _mustBeNew = true);
132  ImportRoute import(VerifiedBlockRef const& _block, OverlayDB const& _db, bool _mustBeNew = true);
133 
137  void insert(bytes const& _block, bytesConstRef _receipts, bool _mustBeNew = true);
138  void insert(VerifiedBlockRef _block, bytesConstRef _receipts, bool _mustBeNew = true);
139 
141  bool isKnown(h256 const& _hash, bool _isCurrent = true) const;
142 
144  BlockHeader info(h256 const& _hash) const { return BlockHeader(headerData(_hash), HeaderData); }
145  BlockHeader info() const { return info(currentHash()); }
146 
148  bytes block(h256 const& _hash) const;
149  bytes block() const { return block(currentHash()); }
150 
152  bytes headerData(h256 const& _hash) const;
153  bytes headerData() const { return headerData(currentHash()); }
154 
156  BlockDetails details(h256 const& _hash) const { return queryExtras<BlockDetails, ExtraDetails>(_hash, m_details, x_details, NullBlockDetails); }
157  BlockDetails details() const { return details(currentHash()); }
158 
160  BlockLogBlooms logBlooms(h256 const& _hash) const { return queryExtras<BlockLogBlooms, ExtraLogBlooms>(_hash, m_logBlooms, x_logBlooms, NullBlockLogBlooms); }
161  BlockLogBlooms logBlooms() const { return logBlooms(currentHash()); }
162 
165  BlockReceipts receipts(h256 const& _hash) const { return queryExtras<BlockReceipts, ExtraReceipts>(_hash, m_receipts, x_receipts, NullBlockReceipts); }
166  BlockReceipts receipts() const { return receipts(currentHash()); }
167 
169  TransactionReceipt transactionReceipt(h256 const& _blockHash, unsigned _i) const { return receipts(_blockHash).receipts[_i]; }
170 
172  TransactionReceipt transactionReceipt(h256 const& _transactionHash) const { TransactionAddress ta = queryExtras<TransactionAddress, ExtraTransactionAddress>(_transactionHash, m_transactionAddresses, x_transactionAddresses, NullTransactionAddress); if (!ta) return bytesConstRef(); return transactionReceipt(ta.blockHash, ta.index); }
173 
175  TransactionHashes transactionHashes(h256 const& _hash) const { auto b = block(_hash); RLP rlp(b); h256s ret; for (auto t: rlp[1]) ret.push_back(sha3(t.data())); return ret; }
176  TransactionHashes transactionHashes() const { return transactionHashes(currentHash()); }
177 
179  UncleHashes uncleHashes(h256 const& _hash) const { auto b = block(_hash); RLP rlp(b); h256s ret; for (auto t: rlp[2]) ret.push_back(sha3(t.data())); return ret; }
180  UncleHashes uncleHashes() const { return uncleHashes(currentHash()); }
181 
183  h256 numberHash(unsigned _i) const { if (!_i) return genesisHash(); return queryExtras<BlockHash, uint64_t, ExtraBlockHash>(_i, m_blockHashes, x_blockHashes, NullBlockHash).value; }
184 
186  LastHashes lastHashes() const { return lastHashes(m_lastBlockHash); }
187  LastHashes lastHashes(h256 const& _mostRecentHash) const;
188 
203  BlocksBlooms blocksBlooms(unsigned _level, unsigned _index) const { return blocksBlooms(chunkId(_level, _index)); }
204  BlocksBlooms blocksBlooms(h256 const& _chunkId) const { return queryExtras<BlocksBlooms, ExtraBlocksBlooms>(_chunkId, m_blocksBlooms, x_blocksBlooms, NullBlocksBlooms); }
205  LogBloom blockBloom(unsigned _number) const { return blocksBlooms(chunkId(0, _number / c_bloomIndexSize)).blooms[_number % c_bloomIndexSize]; }
206  std::vector<unsigned> withBlockBloom(LogBloom const& _b, unsigned _earliest, unsigned _latest) const;
207  std::vector<unsigned> withBlockBloom(LogBloom const& _b, unsigned _earliest, unsigned _latest, unsigned _topLevel, unsigned _index) const;
208 
210  bool isKnownTransaction(h256 const& _transactionHash) const { TransactionAddress ta = queryExtras<TransactionAddress, ExtraTransactionAddress>(_transactionHash, m_transactionAddresses, x_transactionAddresses, NullTransactionAddress); return !!ta; }
211 
213  bytes transaction(h256 const& _transactionHash) const { TransactionAddress ta = queryExtras<TransactionAddress, ExtraTransactionAddress>(_transactionHash, m_transactionAddresses, x_transactionAddresses, NullTransactionAddress); if (!ta) return bytes(); return transaction(ta.blockHash, ta.index); }
214  std::pair<h256, unsigned> transactionLocation(h256 const& _transactionHash) const { TransactionAddress ta = queryExtras<TransactionAddress, ExtraTransactionAddress>(_transactionHash, m_transactionAddresses, x_transactionAddresses, NullTransactionAddress); if (!ta) return std::pair<h256, unsigned>(h256(), 0); return std::make_pair(ta.blockHash, ta.index); }
215 
217  bytes transaction(h256 const& _blockHash, unsigned _i) const { bytes b = block(_blockHash); return RLP(b)[1][_i].data().toBytes(); }
218  bytes transaction(unsigned _i) const { return transaction(currentHash(), _i); }
219 
221  std::vector<bytes> transactions(h256 const& _blockHash) const { bytes b = block(_blockHash); std::vector<bytes> ret; for (auto const& i: RLP(b)[1]) ret.push_back(i.data().toBytes()); return ret; }
222  std::vector<bytes> transactions() const { return transactions(currentHash()); }
223 
225  unsigned number(h256 const& _hash) const { return details(_hash).number; }
226  unsigned number() const { return m_lastBlockNumber; }
227 
229  h256 currentHash() const { ReadGuard l(x_lastBlockHash); return m_lastBlockHash; }
230 
232  h256 genesisHash() const { return m_genesisHash; }
233 
237  h256Hash allKinFrom(h256 const& _parent, unsigned _generations) const;
238 
241  void rebuild(std::string const& _path, ProgressCallback const& _progress = std::function<void(unsigned, unsigned)>());
242 
244  void rewind(unsigned _newHead);
245 
247  void rescue(OverlayDB const& _db);
248 
273  std::tuple<h256s, h256, unsigned> treeRoute(h256 const& _from, h256 const& _to, bool _common = true, bool _pre = true, bool _post = true) const;
274 
275  struct Statistics
276  {
277  unsigned memBlocks;
278  unsigned memDetails;
279  unsigned memLogBlooms;
280  unsigned memReceipts;
282  unsigned memBlockHashes;
283  unsigned memTotal() const { return memBlocks + memDetails + memLogBlooms + memReceipts + memTransactionAddresses + memBlockHashes; }
284  };
285 
287  Statistics usage(bool _freshen = false) const { if (_freshen) updateStats(); return m_lastStats; }
288 
290  void garbageCollect(bool _force = false);
291 
293  void setOnBad(std::function<void(Exception&)> _t) { m_onBad = _t; }
294 
296  void setOnBlockImport(std::function<void(BlockHeader const&)> _t) { m_onBlockImport = _t; }
297 
299  Block genesisBlock(OverlayDB const& _db) const;
300 
302  VerifiedBlockRef verifyBlock(bytesConstRef _block, std::function<void(Exception&)> const& _onBad, ImportRequirements::value _ir = ImportRequirements::OutOfOrderChecks) const;
303 
305  std::string dumpDatabase() const;
306 
307  ChainParams const& chainParams() const { return m_params; }
308 
309  SealEngineFace* sealEngine() const { return m_sealEngine.get(); }
310 
311  BlockHeader const& genesis() const;
312 
313 private:
314  static h256 chunkId(unsigned _level, unsigned _index) { return h256(_index * 0xff + _level); }
315 
317  void init(ChainParams const& _p);
319  unsigned open(std::string const& _path, WithExisting _we);
321  void open(std::string const& _path, WithExisting _we, ProgressCallback const& _pc);
323  void close();
324 
325  template<class T, class K, unsigned N> T queryExtras(K const& _h, std::unordered_map<K, T>& _m, boost::shared_mutex& _x, T const& _n, ldb::DB* _extrasDB = nullptr) const
326  {
327  {
328  ReadGuard l(_x);
329  auto it = _m.find(_h);
330  if (it != _m.end())
331  return it->second;
332  }
333 
334  std::string s;
335  (_extrasDB ? _extrasDB : m_extrasDB)->Get(m_readOptions, toSlice(_h, N), &s);
336  if (s.empty())
337  return _n;
338 
339  noteUsed(_h, N);
340 
341  WriteGuard l(_x);
342  auto ret = _m.insert(std::make_pair(_h, T(RLP(s))));
343  return ret.first->second;
344  }
345 
346  template<class T, unsigned N> T queryExtras(h256 const& _h, std::unordered_map<h256, T>& _m, boost::shared_mutex& _x, T const& _n, ldb::DB* _extrasDB = nullptr) const
347  {
348  return queryExtras<T, h256, N>(_h, _m, _x, _n, _extrasDB);
349  }
350 
351  void checkConsistency();
352 
355  void clearCachesDuringChainReversion(unsigned _firstInvalid);
356  void clearBlockBlooms(unsigned _begin, unsigned _end);
357 
373 
374  using CacheID = std::pair<h256, unsigned>;
376  mutable std::deque<std::unordered_set<CacheID>> m_cacheUsage;
377  mutable std::unordered_set<CacheID> m_inUse;
378  void noteUsed(h256 const& _h, unsigned _extra = (unsigned)-1) const;
379  void noteUsed(uint64_t const& _h, unsigned _extra = (unsigned)-1) const { (void)_h; (void)_extra; } // don't note non-hash types
381 
382  void noteCanonChanged() const { Guard l(x_lastLastHashes); m_lastLastHashes.clear(); }
385 
386  void updateStats() const;
388 
392 
394  mutable boost::shared_mutex x_lastBlockHash;
396  unsigned m_lastBlockNumber = 0;
397 
398  ldb::ReadOptions m_readOptions;
399  ldb::WriteOptions m_writeOptions;
400 
402  std::shared_ptr<SealEngineFace> m_sealEngine; // consider shared_ptr.
404  mutable BlockHeader m_genesis; // mutable because they're effectively memos.
405  mutable bytes m_genesisHeaderBytes; // mutable because they're effectively memos.
406  mutable h256 m_genesisHash; // mutable because they're effectively memos.
407 
408  std::function<void(Exception&)> m_onBad;
409  std::function<void(BlockHeader const&)> m_onBlockImport;
410 
411  std::string m_dbPath;
412 
413  friend std::ostream& operator<<(std::ostream& _out, BlockChain const& _bc);
414 };
415 
416 std::ostream& operator<<(std::ostream& _out, BlockChain const& _bc);
417 
418 }
419 }
UncleHashes uncleHashes() const
Definition: BlockChain.h:180
std::unordered_map< h256, BlocksBlooms > BlocksBloomsHash
Definition: BlockDetails.h:119
std::pair< h256, unsigned > CacheID
Definition: BlockChain.h:374
Statistics usage(bool _freshen=false) const
Definition: BlockChain.h:287
DEV_SIMPLE_EXCEPTION(ChainParamsNotEthash)
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
static h256 chunkId(unsigned _level, unsigned _index)
Definition: BlockChain.h:314
#define function(a, b, c, d, k, s)
T queryExtras(h256 const &_h, std::unordered_map< h256, T > &_m, boost::shared_mutex &_x, T const &_n, ldb::DB *_extrasDB=nullptr) const
Definition: BlockChain.h:346
ChainParams const & chainParams() const
Definition: BlockChain.h:307
std::vector< bytes > transactions() const
Definition: BlockChain.h:222
BlockDetails details(h256 const &_hash) const
Get the familial details concerning a block (or the most recent mined if none given). Thread-safe.
Definition: BlockChain.h:156
size_t operator()(pair< dev::h256, unsigned > const &_x) const
Definition: BlockChain.h:48
ChainParams m_params
Definition: BlockChain.h:401
h256s TransactionHashes
Definition: BlockChain.h:81
BlockHeader info(h256 const &_hash) const
Get the partial-header of a block (or the most recent mined if none given). Thread-safe.
Definition: BlockChain.h:144
bool isKnownTransaction(h256 const &_transactionHash) const
Returns true if transaction is known. Thread-safe.
Definition: BlockChain.h:210
std::chrono::system_clock::time_point m_lastCollection
Definition: BlockChain.h:380
std::unordered_set< CacheID > m_inUse
Definition: BlockChain.h:377
Implements the blockchain database.
Definition: BlockChain.h:105
BlocksBlooms blocksBlooms(h256 const &_chunkId) const
Definition: BlockChain.h:204
SharedMutex x_details
Definition: BlockChain.h:361
bytes rlp(_T _t)
Export a single item in RLP format, returning a byte array.
Definition: RLP.h:467
bytesConstRef data() const
The bare data of the RLP.
Definition: RLP.h:97
Definition: util.h:95
Encapsulation of a block header.
Definition: BlockHeader.h:95
#define T(i, x)
ldb::ReadOptions m_readOptions
Definition: BlockChain.h:398
bytes transaction(h256 const &_blockHash, unsigned _i) const
Get a block&#39;s transaction (RLP format) for the given block hash (or the most recent mined if none giv...
Definition: BlockChain.h:217
std::unordered_map< h256, BlockDetails > BlockDetailsHash
Definition: BlockDetails.h:114
SharedMutex x_blocks
The caches of the disk DB and their locks.
Definition: BlockChain.h:359
BlockReceipts receipts(h256 const &_hash) const
Get the transactions&#39; receipts of a block (or the most recent mined if none given).
Definition: BlockChain.h:165
std::unordered_map< Address, Account > const & genesisState()
T queryExtras(K const &_h, std::unordered_map< K, T > &_m, boost::shared_mutex &_x, T const &_n, ldb::DB *_extrasDB=nullptr) const
Definition: BlockChain.h:325
SharedMutex x_blockHashes
Definition: BlockChain.h:369
LastHashes lastHashes() const
Get the last N hashes for a given block. (N is determined by the LastHashes type.) ...
Definition: BlockChain.h:186
void noteUsed(uint64_t const &_h, unsigned _extra=(unsigned)-1) const
Definition: BlockChain.h:379
std::hash for asio::adress
Definition: Common.h:323
ldb::WriteOptions m_writeOptions
Definition: BlockChain.h:399
LastHashes m_lastLastHashes
Definition: BlockChain.h:384
bytes transaction(unsigned _i) const
Definition: BlockChain.h:218
BlockLogBloomsHash m_logBlooms
Definition: BlockChain.h:364
std::deque< std::unordered_set< CacheID > > m_cacheUsage
Definition: BlockChain.h:376
BlocksBlooms blocksBlooms(unsigned _level, unsigned _index) const
Get the block blooms for a number of blocks.
Definition: BlockChain.h:203
void setOnBlockImport(std::function< void(BlockHeader const &)> _t)
Change the function that is called when a new block is imported.
Definition: BlockChain.h:296
Statistics m_lastStats
Definition: BlockChain.h:387
BlocksHash m_blocks
Definition: BlockChain.h:360
std::shared_ptr< SealEngineFace > m_sealEngine
Definition: BlockChain.h:402
h256s UncleHashes
Definition: BlockChain.h:82
BlockLogBlooms logBlooms() const
Definition: BlockChain.h:161
std::vector< bytes > transactions(h256 const &_blockHash) const
Get all transactions from a block.
Definition: BlockChain.h:221
WithExisting
Definition: Common.h:310
Active model of a block within the block chain.
Definition: Block.h:73
void noteCanonChanged() const
Definition: BlockChain.h:382
boost::shared_mutex x_lastBlockHash
Hash of the last (valid) block on the longest chain.
Definition: BlockChain.h:394
bytes block() const
Definition: BlockChain.h:149
std::vector< h256 > LastHashes
Definition: ExtVMFace.h:191
Base class for all exceptions.
Definition: Exceptions.h:39
std::function< void(Exception &)> m_onBad
Called if we have a block that doesn&#39;t verify.
Definition: BlockChain.h:408
std::lock_guard< std::mutex > Guard
Definition: Guards.h:41
SharedMutex x_blocksBlooms
Definition: BlockChain.h:371
unsigned number(h256 const &_hash) const
Get a number for the given hash (or the most recent mined if none given). Thread-safe.
Definition: BlockChain.h:225
h256 numberHash(unsigned _i) const
Get the hash for a given block&#39;s number.
Definition: BlockChain.h:183
const char * name
Definition: rest.cpp:36
bytes headerData() const
Definition: BlockChain.h:153
unsigned number() const
Definition: BlockChain.h:226
h256 currentHash() const
Get a given block (RLP format). Thread-safe.
Definition: BlockChain.h:229
std::vector< byte > bytes
Definition: Common.h:75
std::pair< h256, unsigned > transactionLocation(h256 const &_transactionHash) const
Definition: BlockChain.h:214
std::vector< unsigned char > toBytes() const
Definition: vector_ref.h:45
vector_ref< byte const > bytesConstRef
Definition: Common.h:77
BlocksBloomsHash m_blocksBlooms
Definition: BlockChain.h:372
FixedHash< 32 > h256
Definition: FixedHash.h:340
A queue of blocks.
Definition: BlockQueue.h:225
std::function< void(BlockHeader const &)> m_onBlockImport
Called if we have imported a new block into the db.
Definition: BlockChain.h:409
std::unordered_map< uint64_t, BlockHash > BlockHashHash
Definition: BlockDetails.h:118
boost::shared_lock< boost::shared_mutex > ReadGuard
Definition: Guards.h:44
BlockReceipts receipts() const
Definition: BlockChain.h:166
TransactionReceipt transactionReceipt(h256 const &_blockHash, unsigned _i) const
Get the transaction by block hash and index;.
Definition: BlockChain.h:169
#define b(i, j)
boost::unique_lock< boost::shared_mutex > WriteGuard
Definition: Guards.h:47
BlockHashHash m_blockHashes
Definition: BlockChain.h:370
void reopen(WithExisting _we=WithExisting::Trust, ProgressCallback const &_pc=ProgressCallback())
Reopen everything.
Definition: BlockChain.h:114
SharedMutex x_logBlooms
Definition: BlockChain.h:363
bytes transaction(h256 const &_transactionHash) const
Get a transaction from its hash. Thread-safe.
Definition: BlockChain.h:213
std::unordered_map< h256, BlockLogBlooms > BlockLogBloomsHash
Definition: BlockDetails.h:115
SharedMutex x_transactionAddresses
Definition: BlockChain.h:367
ldb::Slice toSlice(uint64_t _n, unsigned _sub=0)
Definition: BlockChain.cpp:98
std::unordered_map< h256, TransactionAddress > TransactionAddressHash
Definition: BlockDetails.h:117
Verified block info, does not hold block data, but a reference instead.
Definition: VerifiedBlock.h:36
TransactionHashes transactionHashes(h256 const &_hash) const
Get a list of transaction hashes for a given block. Thread-safe.
Definition: BlockChain.h:175
LastHashes lastHashes(u256 _currentBlockNumber)
Definition: TestHelper.cpp:544
BlockReceiptsHash m_receipts
Definition: BlockChain.h:366
SharedMutex x_genesis
Definition: BlockChain.h:403
void setOnBad(std::function< void(Exception &)> _t)
Change the function that is called with a bad block.
Definition: BlockChain.h:293
ldb::DB * m_extrasDB
Definition: BlockChain.h:391
TransactionReceipt transactionReceipt(h256 const &_transactionHash) const
Get the transaction receipt by transaction hash. Thread-safe.
Definition: BlockChain.h:172
TransactionAddressHash m_transactionAddresses
Definition: BlockChain.h:368
boost::shared_mutex SharedMutex
Definition: Guards.h:39
ldb::DB * m_blocksDB
The disk DBs. Thread-safe, so no need for locks.
Definition: BlockChain.h:390
clock::time_point time_point
Definition: bench.h:49
bool sha3(bytesConstRef _input, bytesRef o_output)
Calculate SHA3-256 hash of the given input and load it into the given output.
Definition: SHA3.cpp:214
LogBloom blockBloom(unsigned _number) const
Definition: BlockChain.h:205
std::string m_dbPath
Definition: BlockChain.h:411
SharedMutex x_receipts
Definition: BlockChain.h:365
std::unordered_map< h256, bytes > BlocksHash
Definition: BlockChain.h:80
std::unordered_map< h256, BlockReceipts > BlockReceiptsHash
Definition: BlockDetails.h:116
std::ostream & operator<<(std::ostream &_out, BlockChain const &_bc)
Definition: BlockChain.cpp:63
h256 genesisHash() const
Get the hash of the genesis block. Thread-safe.
Definition: BlockChain.h:232
The default logging channels.
Definition: Log.h:130
std::unordered_set< h256 > h256Hash
Definition: FixedHash.h:349
std::mutex Mutex
Definition: Guards.h:37
TransactionHashes transactionHashes() const
Definition: BlockChain.h:176
std::vector< h256 > h256s
Definition: FixedHash.h:345
BlockHeader info() const
Definition: BlockChain.h:145
UncleHashes uncleHashes(h256 const &_hash) const
Get a list of uncle hashes for a given block. Thread-safe.
Definition: BlockChain.h:179
BlockHeader m_genesis
Definition: BlockChain.h:404
Class for interpreting Recursive Linear-Prefix Data.
Definition: RLP.h:64
BlockDetails details() const
Definition: BlockChain.h:157
std::function< void(unsigned, unsigned)> ProgressCallback
Definition: BlockChain.h:93
SealEngineFace * sealEngine() const
Definition: BlockChain.h:309
BlockDetailsHash m_details
Definition: BlockChain.h:362
BlockLogBlooms logBlooms(h256 const &_hash) const
Get the transactions&#39; log blooms of a block (or the most recent mined if none given). Thread-safe.
Definition: BlockChain.h:160