From aab0ec06781d44eb98fe2798bf813023889aa6b9 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Mon, 23 Mar 2015 13:08:14 +0100 Subject: [PATCH] add possibility to have in-chain uncles as tests --- blockchain.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/blockchain.cpp b/blockchain.cpp index 0f5eeaee2..50ca22c54 100644 --- a/blockchain.cpp +++ b/blockchain.cpp @@ -72,6 +72,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) // create new "genesis" block RLPStream rlpGenesisBlock = createFullBlockFromHeader(biGenesisBlock); biGenesisBlock.verifyInternals(&rlpGenesisBlock.out()); + o["genesisRLP"] = "0x" + toHex(rlpGenesisBlock.out()); // construct blockchain BlockChain bc(rlpGenesisBlock.out(), string(), true); @@ -114,6 +115,15 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) vBiUncles.push_back(vBiUncles[vBiUncles.size()-1]); continue; } + + if (uncleHeaderObj.count("sameAsBlock")) + { + writeBlockHeaderToJson(uncleHeaderObj_pre, vBiBlocks[(size_t)toInt(uncleHeaderObj["sameAsBlock"])]); + aUncleList.push_back(uncleHeaderObj_pre); + vBiUncles.push_back(vBiBlocks[(size_t)toInt(uncleHeaderObj["sameAsBlock"])]); + continue; + } + BlockInfo uncleBlockFromFields = constructBlock(uncleHeaderObj); // make uncle header valid