diff --git a/libethereum/Block.cpp b/libethereum/Block.cpp index fd2a51527..1c8dc1b21 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 = Ethash::BlockHeader(_header, CheckNothing, h256(), HeaderData); + m_currentBlock = BlockInfo(_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 f030661f1..feadbba73 100644 --- a/libethereum/Block.h +++ b/libethereum/Block.h @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include "Account.h" @@ -253,7 +252,7 @@ public: bytes const& blockData() const { return m_currentBytes; } /// Get the header information on the present block. - Ethash::BlockHeader const& info() const { return m_currentBlock; } + BlockInfo const& info() const { return m_currentBlock; } private: @@ -289,7 +288,7 @@ private: State m_precommit; ///< State at the point immediately prior to rewards. BlockInfo m_previousBlock; ///< The previous block's information. - Ethash::BlockHeader m_currentBlock; ///< The current block's information. + BlockInfo 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/TestHelper.cpp b/test/TestHelper.cpp index 15a5d5633..e7633c5e3 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -269,7 +269,7 @@ int ImportTest::compareStates(State const& _stateExpect, State const& _statePost for (auto const& a: _stateExpect.addresses()) { - CHECK(_statePost.addressInUse(a.first), "Filling Test: " << a.first << " missing expected address!"); + CHECK(_statePost.addressInUse(a.first), "Check State: " << a.first << " missing expected address!"); if (_statePost.addressInUse(a.first)) { AccountMask addressOptions(true); diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 633707560..5a4e65be5 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -73,7 +73,6 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) BlockHeader biGenesisBlock = constructBlock(o["genesisBlockHeader"].get_obj(), h256{}); State trueState(OverlayDB(State::openDB(tdStateDB.path(), h256{}, WithExisting::Kill)), BaseState::Empty); - Block trueBlock; //lastBlock of trueBlockchain ImportTest::importState(o["pre"].get_obj(), trueState); o["pre"] = fillJsonWithState(trueState); //convert all fields to hex trueState.commit(); @@ -218,7 +217,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) txList.push_back(txi); blObj["transactions"] = writeTransactionsToJson(txList); - BlockHeader current_BlockHeader = block.info(); + BlockHeader current_BlockHeader(block.blockData()); RLPStream uncleStream; uncleStream.appendList(vBiUncles.size()); @@ -263,7 +262,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) blObj["rlp"] = toHex(blockRLP.out(), 2, HexPrefix::Add); if (sha3(RLP(block.blockData())[0].data()) != sha3(RLP(blockRLP.out())[0].data())) - { + { cnote << "block header mismatch block.blockData() vs updated block.info()\n"; cnote << toHex(RLP(block.blockData())[0].data()) << "vs" << toHex(RLP(blockRLP.out())[0].data()); } @@ -284,7 +283,9 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) //attempt to import new block to the true blockchain trueBc.sync(uncleBlockQueue, trueState.db(), 4); trueBc.attemptImport(blockRLP.out(), trueState.db()); - trueState = block.state(); + + if (block.blockData() == trueBc.block()) + trueState = block.state(); blockSet newBlock; newBlock.first = blockRLP.out(); @@ -316,7 +317,8 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) AccountMaskMap expectStateMap; State stateExpect(OverlayDB(), BaseState::Empty); ImportTest::importState(o["expect"].get_obj(), stateExpect, expectStateMap); - ImportTest::compareStates(stateExpect, trueBlock.state(), expectStateMap, Options::get().checkState ? WhenError::Throw : WhenError::DontThrow); + if (ImportTest::compareStates(stateExpect, trueState, expectStateMap, Options::get().checkState ? WhenError::Throw : WhenError::DontThrow)) + cerr << testname << endl; o.erase(o.find("expect")); }