From e23d6f68d7d8f334ddd03852568e9a5b6b71f1ef Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Tue, 16 Jun 2015 11:33:57 +0200 Subject: [PATCH] add ability to have invalid Pow in BlockChaintests --- test/libethereum/blockchain.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 2c4a0b498..50e10bb8a 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -581,6 +581,12 @@ mArray importUncles(mObject const& _blObj, vector& _vBiUncles, vector } updatePoW(uncleBlockFromFields); + if (overwrite == "nonce" || overwrite == "mixHash") + { + uncleBlockFromFields.nonce = overwrite == "nonce" ? Nonce(uncleHeaderObj["nonce"].get_str()) : uncleBlockFromFields.nonce; + uncleBlockFromFields.mixHash = overwrite == "mixHash" ? h256(uncleHeaderObj["mixHash"].get_str()) : uncleBlockFromFields.mixHash; + } + writeBlockHeaderToJson(uncleHeaderObj, uncleBlockFromFields); aUncleList.push_back(uncleHeaderObj); @@ -677,16 +683,18 @@ void overwriteBlockHeader(BlockInfo& _header, mObject& _blObj) tmp.timestamp = toInt(ho["timestamp"]); if (ho.count("extraData")) tmp.extraData = importByteArray(ho["extraData"].get_str()); - if (ho.count("mixHash")) - tmp.mixHash = h256(ho["mixHash"].get_str()); - tmp.noteDirty(); // find new valid nonce if (tmp != _header) - { mine(tmp); - _header = tmp; - } + + if (ho.count("mixHash")) + tmp.mixHash = h256(ho["mixHash"].get_str()); + if (ho.count("nonce")) + tmp.nonce = Nonce(ho["nonce"].get_str()); + + tmp.noteDirty(); + _header = tmp; } else {