Browse Source

add ability to have invalid Pow in BlockChaintests

cl-refactor
CJentzsch 10 years ago
parent
commit
e23d6f68d7
  1. 20
      test/libethereum/blockchain.cpp

20
test/libethereum/blockchain.cpp

@ -581,6 +581,12 @@ mArray importUncles(mObject const& _blObj, vector<BlockInfo>& _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
{

Loading…
Cancel
Save