From 38bf18de816a6d62fcfae5c656b72633eeaa66cb Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Thu, 14 May 2015 21:59:36 +0200 Subject: [PATCH] fix in chain uncle tests --- test/libethereum/blockchain.cpp | 35 ++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 824eafe26..191b94cc3 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -204,6 +204,20 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) blObj["transactions"] = writeTransactionsToJson(txList); BlockInfo current_BlockHeader = state.info(); + + RLPStream uncleStream; + uncleStream.appendList(vBiUncles.size()); + for (unsigned i = 0; i < vBiUncles.size(); ++i) + { + RLPStream uncleRlp; + vBiUncles[i].streamRLP(uncleRlp, WithNonce); + uncleStream.appendRaw(uncleRlp.out()); + } + + // update unclehash in case of invalid uncles + current_BlockHeader.sha3Uncles = sha3(uncleStream.out()); + updatePoW(current_BlockHeader); + if (blObj.count("blockHeader")) overwriteBlockHeader(current_BlockHeader, blObj); @@ -223,15 +237,6 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) txStream.appendRaw(txrlp.out()); } - RLPStream uncleStream; - uncleStream.appendList(vBiUncles.size()); - for (unsigned i = 0; i < vBiUncles.size(); ++i) - { - RLPStream uncleRlp; - vBiUncles[i].streamRLP(uncleRlp, WithNonce); - uncleStream.appendRaw(uncleRlp.out()); - } - RLPStream block2 = createFullBlockFromHeader(current_BlockHeader, txStream.out(), uncleStream.out()); blObj["rlp"] = toHex(block2.out(), 2, HexPrefix::Add); @@ -497,14 +502,20 @@ mArray importUncles(mObject const& blObj, vector& vBiUncles, vector