Browse Source

Merge pull request #2062 from CJentzsch/fixUncleIsBrother

forbid uncle to be your brother
cl-refactor
Gav Wood 10 years ago
parent
commit
d8b7605c21
  1. 15
      libethcore/Exceptions.h
  2. 8
      libethereum/State.cpp

15
libethcore/Exceptions.h

@ -49,27 +49,28 @@ struct FeeTooSmall: virtual dev::Exception {};
struct TooMuchGasUsed: virtual dev::Exception {}; struct TooMuchGasUsed: virtual dev::Exception {};
struct ExtraDataTooBig: virtual dev::Exception {}; struct ExtraDataTooBig: virtual dev::Exception {};
struct InvalidSignature: virtual dev::Exception {}; struct InvalidSignature: virtual dev::Exception {};
class InvalidBlockFormat: virtual public dev::Exception {}; struct InvalidBlockFormat: virtual dev::Exception {};
struct InvalidUnclesHash: virtual dev::Exception {}; struct InvalidUnclesHash: virtual dev::Exception {};
struct InvalidUncle: virtual dev::Exception {}; struct InvalidUncle: virtual dev::Exception {};
struct TooManyUncles: virtual dev::Exception {}; struct TooManyUncles: virtual dev::Exception {};
struct UncleTooOld: virtual dev::Exception {}; struct UncleTooOld: virtual dev::Exception {};
class UncleInChain: virtual public dev::Exception {}; struct UncleIsBrother: virtual dev::Exception {};
struct UncleInChain: virtual dev::Exception {};
struct DuplicateUncleNonce: virtual dev::Exception {}; struct DuplicateUncleNonce: virtual dev::Exception {};
struct InvalidStateRoot: virtual dev::Exception {}; struct InvalidStateRoot: virtual dev::Exception {};
struct InvalidGasUsed: virtual dev::Exception {}; struct InvalidGasUsed: virtual dev::Exception {};
class InvalidTransactionsHash: virtual public dev::Exception {}; struct InvalidTransactionsHash: virtual dev::Exception {};
struct InvalidTransaction: virtual dev::Exception {}; struct InvalidTransaction: virtual dev::Exception {};
struct InvalidDifficulty: virtual dev::Exception {}; struct InvalidDifficulty: virtual dev::Exception {};
class InvalidGasLimit: virtual public dev::Exception {}; struct InvalidGasLimit: virtual dev::Exception {};
struct InvalidTransactionGasUsed: virtual dev::Exception {}; struct InvalidTransactionGasUsed: virtual dev::Exception {};
struct InvalidTransactionsStateRoot: virtual dev::Exception {}; struct InvalidTransactionsStateRoot: virtual dev::Exception {};
struct InvalidReceiptsStateRoot: virtual dev::Exception {}; struct InvalidReceiptsStateRoot: virtual dev::Exception {};
struct InvalidTimestamp: virtual dev::Exception {}; struct InvalidTimestamp: virtual dev::Exception {};
struct InvalidLogBloom: virtual dev::Exception {}; struct InvalidLogBloom: virtual dev::Exception {};
class InvalidNonce: virtual public dev::Exception {}; struct InvalidNonce: virtual dev::Exception {};
class InvalidBlockHeaderItemCount: virtual public dev::Exception {}; struct InvalidBlockHeaderItemCount: virtual dev::Exception {};
class InvalidBlockNonce: virtual public dev::Exception {}; struct InvalidBlockNonce: virtual dev::Exception {};
struct InvalidParentHash: virtual dev::Exception {}; struct InvalidParentHash: virtual dev::Exception {};
struct InvalidNumber: virtual dev::Exception {}; struct InvalidNumber: virtual dev::Exception {};
struct InvalidContractAddress: virtual public dev::Exception {}; struct InvalidContractAddress: virtual public dev::Exception {};

8
libethereum/State.cpp

@ -726,6 +726,14 @@ u256 State::enact(bytesConstRef _block, BlockChain const& _bc, ImportRequirement
cwarn << " Block number: " << m_currentBlock.number; cwarn << " Block number: " << m_currentBlock.number;
BOOST_THROW_EXCEPTION(UncleTooOld()); BOOST_THROW_EXCEPTION(UncleTooOld());
} }
else if (uncle.number == m_currentBlock.number)
{
badBlock(_block, "Uncle is brother");
cwarn << " Uncle number: " << uncle.number;
cwarn << " Uncle parent number: " << uncleParent.number;
cwarn << " Block number: " << m_currentBlock.number;
BOOST_THROW_EXCEPTION(UncleIsBrother());
}
uncle.verifyParent(uncleParent); uncle.verifyParent(uncleParent);
// tdIncrease += uncle.difficulty; // tdIncrease += uncle.difficulty;

Loading…
Cancel
Save