From 238f17e79bed267af1b2a67e3b95d51a6e1a621d Mon Sep 17 00:00:00 2001 From: Dimitry Date: Fri, 14 Aug 2015 16:38:38 +0300 Subject: [PATCH] BlockChainTests mining --- libethereum/Block.cpp | 2 +- libethereum/Block.h | 5 +++-- test/libethereum/blockchain.cpp | 6 ++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libethereum/Block.cpp b/libethereum/Block.cpp index 1c8dc1b21..fd2a51527 100644 --- a/libethereum/Block.cpp +++ b/libethereum/Block.cpp @@ -709,7 +709,7 @@ bool Block::sealBlock(bytesConstRef _header) ret.appendRaw(m_currentTxs); ret.appendRaw(m_currentUncles); ret.swapOut(m_currentBytes); - m_currentBlock = BlockInfo(_header, CheckNothing, h256(), HeaderData); + m_currentBlock = Ethash::BlockHeader(_header, CheckNothing, h256(), HeaderData); cnote << "Mined " << m_currentBlock.hash() << "(parent: " << m_currentBlock.parentHash() << ")"; // TODO: move into Sealer StructuredLogger::minedNewBlock( diff --git a/libethereum/Block.h b/libethereum/Block.h index feadbba73..f030661f1 100644 --- a/libethereum/Block.h +++ b/libethereum/Block.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include "Account.h" @@ -252,7 +253,7 @@ public: bytes const& blockData() const { return m_currentBytes; } /// Get the header information on the present block. - BlockInfo const& info() const { return m_currentBlock; } + Ethash::BlockHeader const& info() const { return m_currentBlock; } private: @@ -288,7 +289,7 @@ private: State m_precommit; ///< State at the point immediately prior to rewards. BlockInfo m_previousBlock; ///< The previous block's information. - BlockInfo m_currentBlock; ///< The current block's information. + Ethash::BlockHeader m_currentBlock; ///< The current block's information. bytes m_currentBytes; ///< The current block. bool m_committedToMine = false; ///< Have we committed to mine on the present m_currentBlock? diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index df50e3318..aed4ddf82 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -128,12 +128,12 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) vBiBlocks.clear(); vBiBlocks.push_back(biGenesisBlock); - TransientDirectory td_stateDB, td_bc; + TransientDirectory td_bc; + TransientDirectory td_stateDB; FullBlockChain bc(rlpGenesisBlock.out(), AccountMap(), td_bc.path(), WithExisting::Kill); OverlayDB database (State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)); State state(database, BaseState::Empty); - Block block(database, BaseState::Empty, biGenesisBlock.beneficiary()); state = importer.m_statePre; state.commit(); @@ -188,7 +188,9 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) cnote << "error in importing uncle! This produces an invalid block (May be by purpose for testing)."; } } + bc.sync(uncleBlockQueue, state.db(), 4); + Block block = bc.genesisBlock(state.db()); //mine a new block on top of previously imported try