25 #include <unordered_map> 42 namespace test {
class ImportTest;
class StateLoader; }
50 class TransactionQueue;
51 struct VerifiedBlockRef;
52 class LastBlockHashesFace;
145 std::map<h256, std::pair<u256, u256>>
storage(
Address const& _contract)
const {
return m_state.
storage(_contract); }
266 bool isSealed()
const {
return !m_currentBytes.empty(); }
279 void uncommitToSeal();
286 void applyRewards(std::vector<BlockHeader>
const& _uncleBlockHeaders,
u256 const& _blockReward);
289 u256 gasUsed()
const {
return m_receipts.size() ? m_receipts.back().cumulativeGasUsed() : 0; }
292 void performIrregularModifications();
295 void updateBlockhashContract();
303 BlockHeader m_previousBlock;
304 BlockHeader m_currentBlock;
305 bytes m_currentBytes;
306 bool m_committedToSeal =
false;
309 bytes m_currentUncles;
313 SealEngineFace* m_sealEngine =
nullptr;
h256 stateRootBeforeTx(unsigned _i) const
u256 getNonce(Address const &_addr) const
std::unordered_map< Address, u256 > addresses() const
Address author() const
Get the author address for any transactions we do and rewards we get.
bytes const & code(Address const &_contract) const
bytes const & code(Address const &_addr) const
u256 storage(Address const &_contract, u256 const &_memory) const
std::function< void(uint64_t, uint64_t, Instruction, bigint, bigint, bigint, VMFace const *, ExtVMFace const *)> OnOpFunc
std::pair< TransactionReceipts, bool > sync(BlockChain const &_bc, TransactionQueue &_tq, GasPricer const &_gp, unsigned _msTimeout=100)
h256 rootHash() const
The hash of the root of our state tree.
A queue of Transactions, each stored as RLP. Maintains a transaction queue sorted by nonce diff and g...
int64_t utcTime()
Get the current time in seconds since the epoch in UTC.
Implements the blockchain database. All data this gives is disk-backed. .
void noteChain(BlockChain const &_bc)
u256 transactionsFrom(Address const &_address) const
bytes const & blockData() const
void cleanup()
Returns back to a pristine state after having done a playback.
std::vector< Transaction > Transactions
Nice name for vector of Transaction.
Interface for getting a list of recent block hashes .
Transactions const & pending() const
Get the list of pending transactions.
LogEntries const & log() const
void commitToSeal(BlockChain const &_bc, bytes const &_extraData={})
LogBloom logBloom() const
Get the bloom filter of all logs that happened in the block.
LogBloom const & logBloom(unsigned _i) const
Get the bloom filter of a particular transaction that happened in the block.
Block(u256 const &_accountStartNonce)
Default constructor; creates with a blank database prepopulated with the genesis block.
Description of the result of executing a transaction.
bool addressInUse(Address const &_address) const
Check if the address is in use.
std::map< h256, std::pair< u256, u256 > > storage(Address const &_contract) const
u256 enactOn(VerifiedBlockRef const &_block, BlockChain const &_bc)
OverlayDB const & db() const
Open a DB - useful for passing into the constructor & keeping for other states that are necessary...
Active model of a block within the block chain. Keeps track of all transactions, receipts and state f...
std::vector< TransactionReceipt > TransactionReceipts
bool addressHasCode(Address const &_address) const
Check if the address contains executable code.
TransactionReceipt const & receipt(unsigned _i) const
Get the transaction receipt for the transaction of the given index.
PopulationStatistics populateFromChain(BlockChain const &_bc, h256 const &_hash, ImportRequirements::value _ir=ImportRequirements::None)
Construct state object from arbitrary point in blockchain.
LogBloom const & bloom() const
bool addressInUse(Address const &_address) const
Check if the address is in use.
friend class dev::test::ImportTest
void resetCurrent(int64_t _timestamp=utcTime())
Logger createLogger(int _severity, std::string const &_channel)
std::vector< byte > bytes
h256 storageRoot(Address const &_contract) const
Get the root of the storage of an account.
h256 storageRoot(Address const &_contract) const
Get the root of the storage of an account.
bool addressHasCode(Address const &_address) const
Check if the address contains executable code.
Message-call/contract-creation executor; useful for executing transactions.
bool sealBlock(bytes const &_header)
u256 balance(Address const &_id) const
Encodes a transaction, ready to be exported to or freshly imported from RLP.
std::unordered_map< Address, u256 > addresses() const
u256 balance(Address const &_address) const
State const & state() const
Get the backing state object.
void setAuthor(Address const &_id)
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > > u256
ExecutionResult execute(LastBlockHashesFace const &_lh, Transaction const &_t, Permanence _p=Permanence::Committed, OnOpFunc const &_onOp=OnOpFunc())
LogEntries const & log(unsigned _i) const
Get the list of pending transactions.
Verified block info, does not hold block data, but a reference instead.
BlockHeader const & info() const
Get the header information on the present block.
friend class dev::test::StateLoader
Block(BlockChain const &_bc)
Construct from a given blockchain. Empty, but associated with _bc 's chain params.
Externality interface for the Virtual Machine providing access to world state.
u256 gasLimitRemaining() const
Get the remaining gas limit in this block.
DEV_SIMPLE_EXCEPTION(NoHashRecorded)
h256 codeHash(Address const &_contract) const
h256 rootHash() const
The hash of the root of our state tree.
std::unordered_set< h256 > h256Hash
u256 storage(Address const &_contract, u256 const &_memory) const
h256Hash const & pendingHashes() const
Get the list of hashes of pending transactions.
Block & operator=(Block const &_s)
Copy state object.
std::vector< LogEntry > LogEntries
boost::log::sources::severity_channel_logger<> Logger
OverlayDB const & db() const
h256 codeHash(Address const &_contract) const