25 #include <unordered_map> 51 class TransactionQueue;
52 struct VerifiedBlockRef;
77 friend class dev::test::StateLoader;
150 std::map<h256, std::pair<u256, u256>>
storage(
Address const& _contract)
const {
return m_state.storage(_contract); }
173 std::unordered_map<Address, u256>
addresses()
const {
return m_state.addresses(); }
208 State fromPending(
unsigned _i)
const;
237 void cleanup(
bool _fullCommit);
251 void commitToSeal(
BlockChain const& _bc,
bytes const& _extraData = {});
272 bool isSealed()
const {
return !m_currentBytes.empty(); }
285 void uncommitToSeal();
291 void ensureCached(
Address const& _a,
bool _requireCode,
bool _forceCreate)
const;
294 void ensureCached(std::unordered_map<Address, Account>& _cache,
Address const& _a,
bool _requireCode,
bool _forceCreate)
const;
301 void applyRewards(std::vector<BlockHeader>
const& _uncleBlockHeaders,
u256 const& _blockReward);
304 u256 gasUsed()
const {
return m_receipts.size() ? m_receipts.back().gasUsed() : 0; }
307 void performIrregularModifications();
321 bool m_committedToSeal =
false;
bytes const & blockData() const
Get the complete current block, including valid nonce.
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
State const & state() const
Get the backing state object.
std::function< void(uint64_t, uint64_t, dev::eth::Instruction, dev::bigint, dev::bigint, dev::bigint, dev::eth::VM *, dev::eth::ExtVMFace const *)> OnOpFunc
A queue of Transactions, each stored as RLP.
Transactions m_transactions
The current list of transactions that we've included in the state.
h256Hash const & pendingHashes() const
Get the list of hashes of pending transactions.
bool addressInUse(Address const &_address) const
Check if the address is in use.
bytes const & code(Address const &_contract) const
Get the code of an account.
Implements the blockchain database.
uint64_t utcTime()
Get the current time in seconds since the epoch in UTC.
bool addressHasCode(Address const &_address) const
Check if the address contains executable code.
h160 Address
An Ethereum address: 20 bytes.
std::vector< Transaction > Transactions
Nice name for vector of Transaction.
bytes m_currentBytes
The current block's bytes.
u256 transactionsFrom(Address const &_address) const
Get the number of transactions a particular address has sent (used for the transaction nonce)...
Block(u256 const &_accountStartNonce)
Default constructor; creates with a blank database prepopulated with the genesis block.
TransactionReceipts m_receipts
The corresponding list of transaction receipts.
Description of the result of executing a transaction.
Model of an Ethereum state, essentially a facade for the trie.
TransactionReceipt const & receipt(unsigned _i) const
Get the transaction receipt for the transaction of the given index.
LogEntries const & log(unsigned _i) const
Get the list of pending transactions.
u256 storage(Address const &_contract, u256 const &_memory) const
Get the value of a storage position of an account.
h256 codeHash(Address const &_contract) const
Get the code hash of an account.
Active model of a block within the block chain.
std::vector< TransactionReceipt > TransactionReceipts
std::vector< h256 > LastHashes
u256 gasLimitRemaining() const
Get the remaining gas limit in this block.
Address m_author
Our address (i.e. the address to which fees go).
BlockHeader m_currentBlock
The current block's information.
std::unordered_map< Address, u256 > addresses() const
BlockGetAndPut< word32, BigEndian > Block
std::vector< byte > bytes
Fixed-size raw-byte array container type, with an API optimised for storing hashes.
BlockHeader m_previousBlock
The previous block's information.
std::function< void(uint64_t, uint64_t, Instruction, bigint, bigint, bigint, VM *, ExtVMFace const *)> OnOpFunc
Message-call/contract-creation executor; useful for executing transactions.
bool sealBlock(bytes const &_header)
Pass in a properly sealed header matching this block.
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
Transactions const & pending() const
Get the list of pending transactions.
Encodes a transaction, ready to be exported to or freshly imported from RLP.
OverlayDB const & db() const
Open a DB - useful for passing into the constructor & keeping for other states that are necessary...
DEV_SIMPLE_EXCEPTION(BadHexCharacter)
Address author() const
Get the author address for any transactions we do and rewards we get.
std::map< h256, std::pair< u256, u256 > > storage(Address const &_contract) const
Get the storage of an account.
State m_precommit
State at the point immediately prior to rewards.
void setAuthor(Address const &_id)
Set the author address for any transactions we do and rewards we get.
u256 balance(Address const &_address) const
Get an account's balance.
State & mutableState()
Get a mutable State object which is backing this block.
Verified block info, does not hold block data, but a reference instead.
h256Hash m_transactionSet
The set of transaction hashes that we've included in the state.
bytes m_currentUncles
The RLP-encoded block of uncles.
Block(BlockChain const &_bc)
Construct from a given blockchain. Empty, but associated with _bc 's chain params.
h256 rootHash() const
The hash of the root of our state tree.
Externality interface for the Virtual Machine providing access to world state.
LogBloom const & logBloom(unsigned _i) const
Get the bloom filter of a particular transaction that happened in the block.
The default logging channels.
std::unordered_set< h256 > h256Hash
bytes m_currentTxs
The RLP-encoded block of transactions.
std::ostream & operator<<(std::ostream &out, Stats::clock::duration const &d)
State m_state
Our state tree, as an OverlayDB DB.
h256 storageRoot(Address const &_contract) const
Get the root of the storage of an account.
BlockHeader const & info() const
Get the header information on the present block.
std::vector< LogEntry > LogEntries