Browse Source

Fix extraData reporting.

cl-refactor
Gav Wood 10 years ago
parent
commit
18efffe220
  1. 3
      libethereum/BlockChain.cpp
  2. 9
      libethereum/BlockChain.h
  3. 2
      libethereum/Client.cpp

3
libethereum/BlockChain.cpp

@ -620,6 +620,9 @@ ImportRoute BlockChain::import(VerifiedBlockRef const& _block, OverlayDB const&
{
ex << errinfo_now(time(0));
ex << errinfo_block(_block.block.toBytes());
// only populate extraData if we actually managed to extract it. otherwise,
// we might be clobbering the existing one.
if (!_block.info.extraData().empty())
ex << errinfo_extraData(_block.info.extraData());
throw;
}

9
libethereum/BlockChain.h

@ -419,6 +419,9 @@ public:
ex << errinfo_phase(1);
ex << errinfo_now(time(0));
ex << errinfo_block(_block.toBytes());
// only populate extraData if we actually managed to extract it. otherwise,
// we might be clobbering the existing one.
if (!h.extraData().empty())
ex << errinfo_extraData(h.extraData());
if (_onBad)
_onBad(ex);
@ -441,6 +444,9 @@ public:
ex << errinfo_uncleIndex(i);
ex << errinfo_now(time(0));
ex << errinfo_block(_block.toBytes());
// only populate extraData if we actually managed to extract it. otherwise,
// we might be clobbering the existing one.
if (!h.extraData().empty())
ex << errinfo_extraData(h.extraData());
if (_onBad)
_onBad(ex);
@ -463,6 +469,9 @@ public:
ex << errinfo_transactionIndex(i);
ex << errinfo_transaction(d.toBytes());
ex << errinfo_block(_block.toBytes());
// only populate extraData if we actually managed to extract it. otherwise,
// we might be clobbering the existing one.
if (!h.extraData().empty())
ex << errinfo_extraData(h.extraData());
if (_onBad)
_onBad(ex);

2
libethereum/Client.cpp

@ -219,10 +219,10 @@ void Client::onBadBlock(Exception& _ex) const
}
if (bytes const* ed = boost::get_error_info<errinfo_extraData>(_ex))
{
RLP r(*ed);
report["hints"]["extraData"] = toHex(*ed);
try
{
RLP r(*ed);
if (r[0].toInt<int>() == 0)
report["hints"]["minerVersion"] = r[1].toString();
}

Loading…
Cancel
Save