Browse Source

Fix extraData reporting.

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

5
libethereum/BlockChain.cpp

@ -620,7 +620,10 @@ ImportRoute BlockChain::import(VerifiedBlockRef const& _block, OverlayDB const&
{
ex << errinfo_now(time(0));
ex << errinfo_block(_block.block.toBytes());
ex << errinfo_extraData(_block.info.extraData());
// 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;
}
#endif

15
libethereum/BlockChain.h

@ -419,7 +419,10 @@ public:
ex << errinfo_phase(1);
ex << errinfo_now(time(0));
ex << errinfo_block(_block.toBytes());
ex << errinfo_extraData(h.extraData());
// 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);
throw;
@ -441,7 +444,10 @@ public:
ex << errinfo_uncleIndex(i);
ex << errinfo_now(time(0));
ex << errinfo_block(_block.toBytes());
ex << errinfo_extraData(h.extraData());
// 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);
throw;
@ -463,7 +469,10 @@ public:
ex << errinfo_transactionIndex(i);
ex << errinfo_transaction(d.toBytes());
ex << errinfo_block(_block.toBytes());
ex << errinfo_extraData(h.extraData());
// 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);
throw;

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