|
@ -577,6 +577,9 @@ u256 State::enact(bytesConstRef _block, BlockChain const* _bc, bool _checkNonce) |
|
|
set<h256> knownUncles = _bc ? _bc->allUnclesFrom(m_currentBlock.parentHash) : set<h256>(); |
|
|
set<h256> knownUncles = _bc ? _bc->allUnclesFrom(m_currentBlock.parentHash) : set<h256>(); |
|
|
for (auto const& i: RLP(_block)[2]) |
|
|
for (auto const& i: RLP(_block)[2]) |
|
|
{ |
|
|
{ |
|
|
|
|
|
if (knownUncles.count(sha3(i.data()))) |
|
|
|
|
|
throw UncleInChain(knownUncles, sha3(i.data())); |
|
|
|
|
|
|
|
|
BlockInfo uncle = BlockInfo::fromHeader(i.data()); |
|
|
BlockInfo uncle = BlockInfo::fromHeader(i.data()); |
|
|
if (nonces.count(uncle.nonce)) |
|
|
if (nonces.count(uncle.nonce)) |
|
|
throw DuplicateUncleNonce(); |
|
|
throw DuplicateUncleNonce(); |
|
@ -585,8 +588,6 @@ u256 State::enact(bytesConstRef _block, BlockChain const* _bc, bool _checkNonce) |
|
|
BlockInfo uncleParent(_bc->block(uncle.parentHash)); |
|
|
BlockInfo uncleParent(_bc->block(uncle.parentHash)); |
|
|
if ((bigint)uncleParent.number < (bigint)m_currentBlock.number - 6) |
|
|
if ((bigint)uncleParent.number < (bigint)m_currentBlock.number - 6) |
|
|
throw UncleTooOld(); |
|
|
throw UncleTooOld(); |
|
|
if (knownUncles.count(sha3(i.data()))) |
|
|
|
|
|
throw UncleInChain(); |
|
|
|
|
|
uncle.verifyParent(uncleParent); |
|
|
uncle.verifyParent(uncleParent); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -725,7 +726,7 @@ void State::commitToMine(BlockChain const& _bc) |
|
|
auto us = _bc.details(p).children; |
|
|
auto us = _bc.details(p).children; |
|
|
assert(us.size() >= 1); // must be at least 1 child of our grandparent - it's our own parent!
|
|
|
assert(us.size() >= 1); // must be at least 1 child of our grandparent - it's our own parent!
|
|
|
for (auto const& u: us) |
|
|
for (auto const& u: us) |
|
|
if (!knownUncles.count(BlockInfo::headerHash(_bc.block(u)))) // ignore any uncles/mainline blocks that we know about. We use header-hash for this.
|
|
|
if (!knownUncles.count(u)) // ignore any uncles/mainline blocks that we know about.
|
|
|
{ |
|
|
{ |
|
|
BlockInfo ubi(_bc.block(u)); |
|
|
BlockInfo ubi(_bc.block(u)); |
|
|
ubi.fillStream(unclesData, true); |
|
|
ubi.fillStream(unclesData, true); |
|
|