|
@ -125,10 +125,16 @@ void BlockInfo::populateFromHeader(RLP const& _header, bool _checkNonce) |
|
|
BOOST_THROW_EXCEPTION(InvalidBlockNonce(headerHash(WithoutNonce), nonce, difficulty)); |
|
|
BOOST_THROW_EXCEPTION(InvalidBlockNonce(headerHash(WithoutNonce), nonce, difficulty)); |
|
|
|
|
|
|
|
|
if (gasUsed > gasLimit) |
|
|
if (gasUsed > gasLimit) |
|
|
BOOST_THROW_EXCEPTION(TooMuchGasUsed()); |
|
|
BOOST_THROW_EXCEPTION(TooMuchGasUsed() << RequirementError(bigint(gasLimit), bigint(gasUsed)) ); |
|
|
|
|
|
|
|
|
|
|
|
if (difficulty < c_minimumDifficulty) |
|
|
|
|
|
BOOST_THROW_EXCEPTION(InvalidDifficulty() << RequirementError(bigint(c_minimumDifficulty), bigint(difficulty)) ); |
|
|
|
|
|
|
|
|
|
|
|
if (gasLimit < c_minGasLimit) |
|
|
|
|
|
BOOST_THROW_EXCEPTION(InvalidGasLimit() << RequirementError(bigint(c_minGasLimit), bigint(gasLimit)) ); |
|
|
|
|
|
|
|
|
if (number && extraData.size() > c_maximumExtraDataSize) |
|
|
if (number && extraData.size() > c_maximumExtraDataSize) |
|
|
BOOST_THROW_EXCEPTION(ExtraDataTooBig()); |
|
|
BOOST_THROW_EXCEPTION(ExtraDataTooBig() << RequirementError(bigint(c_maximumExtraDataSize), bigint(extraData.size()))); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void BlockInfo::populate(bytesConstRef _block, bool _checkNonce) |
|
|
void BlockInfo::populate(bytesConstRef _block, bool _checkNonce) |
|
@ -207,7 +213,7 @@ void BlockInfo::verifyParent(BlockInfo const& _parent) const |
|
|
{ |
|
|
{ |
|
|
// Check difficulty is correct given the two timestamps.
|
|
|
// Check difficulty is correct given the two timestamps.
|
|
|
if (difficulty != calculateDifficulty(_parent)) |
|
|
if (difficulty != calculateDifficulty(_parent)) |
|
|
BOOST_THROW_EXCEPTION(InvalidDifficulty()); |
|
|
BOOST_THROW_EXCEPTION(InvalidDifficulty() << RequirementError((bigint)calculateDifficulty(_parent), (bigint)difficulty)); |
|
|
|
|
|
|
|
|
if (gasLimit < _parent.gasLimit * (c_gasLimitBoundDivisor - 1) / c_gasLimitBoundDivisor || |
|
|
if (gasLimit < _parent.gasLimit * (c_gasLimitBoundDivisor - 1) / c_gasLimitBoundDivisor || |
|
|
gasLimit > _parent.gasLimit * (c_gasLimitBoundDivisor + 1) / c_gasLimitBoundDivisor) |
|
|
gasLimit > _parent.gasLimit * (c_gasLimitBoundDivisor + 1) / c_gasLimitBoundDivisor) |
|
|