Browse Source

Additional check in header for too many items.

cl-refactor
Gav Wood 10 years ago
parent
commit
73f85c8286
  1. 2
      libethcore/BlockInfo.cpp
  2. 1
      libethcore/Exceptions.h

2
libethcore/BlockInfo.cpp

@ -104,6 +104,8 @@ void BlockInfo::populateFromHeader(RLP const& _header, Strictness _s)
int field = 0;
try
{
if (_header.itemCount() != 15)
throw InvalidBlockHeaderItemCount();
parentHash = _header[field = 0].toHash<h256>(RLP::VeryStrict);
sha3Uncles = _header[field = 1].toHash<h256>(RLP::VeryStrict);
coinbaseAddress = _header[field = 2].toHash<Address>(RLP::VeryStrict);

1
libethcore/Exceptions.h

@ -67,6 +67,7 @@ struct InvalidReceiptsStateRoot: virtual dev::Exception {};
struct InvalidTimestamp: virtual dev::Exception {};
struct InvalidLogBloom: virtual dev::Exception {};
class InvalidNonce: virtual public dev::Exception {};
class InvalidBlockHeaderItemCount: virtual public dev::Exception {};
class InvalidBlockNonce: virtual public dev::Exception {};
struct InvalidParentHash: virtual dev::Exception {};
struct InvalidNumber: virtual dev::Exception {};

Loading…
Cancel
Save