aboutsummaryrefslogtreecommitdiffstats
path: root/blockchain.cpp
diff options
context:
space:
mode:
authorCJentzsch <jentzsch.software@gmail.com>2015-03-06 16:14:45 +0800
committerGav Wood <i@gavwood.com>2015-03-06 19:46:24 +0800
commit281cbf5351efcee0f0bdb862ae7f7f1dd97066af (patch)
tree5d184c621a6c337c9a28e48e673c05f482194b9c /blockchain.cpp
parent47321f973cb99f7568be82fa223b3f035a51b70c (diff)
downloaddexon-solidity-281cbf5351efcee0f0bdb862ae7f7f1dd97066af.tar.gz
dexon-solidity-281cbf5351efcee0f0bdb862ae7f7f1dd97066af.tar.zst
dexon-solidity-281cbf5351efcee0f0bdb862ae7f7f1dd97066af.zip
try to have a uncle with block number = 1
Diffstat (limited to 'blockchain.cpp')
-rw-r--r--blockchain.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/blockchain.cpp b/blockchain.cpp
index e453e32a..7f840bc7 100644
--- a/blockchain.cpp
+++ b/blockchain.cpp
@@ -80,6 +80,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin)
BOOST_REQUIRE(o.count("blocks"));
mArray blArray;
vector<BlockInfo> vBiBlocks;
+ vBiBlocks.push_back(biGenesisBlock);
for (auto const& bl: o["blocks"].get_array())
{
mObject blObj = bl.get_obj();
@@ -107,7 +108,10 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin)
// make uncle header valid
uncleBlockFromFields.timestamp = (u256)time(0);
- uncleBlockFromFields.populateFromParent(vBiBlocks[vBiBlocks.size()-2]);
+ if (vBiBlocks.size() > 2)
+ uncleBlockFromFields.populateFromParent(vBiBlocks[vBiBlocks.size()-2]);
+ else
+ continue;
updatePoW(uncleBlockFromFields);
writeBlockHeaderToJson(uncleHeaderObj, uncleBlockFromFields);