Browse Source

Force Interpreter VM when VM tracing requested.

Fixes https://github.com/ethereum/cpp-ethereum/issues/2585.
cl-refactor
Paweł Bylica 10 years ago
parent
commit
f16cb2e23e
  1. 27
      libethereum/State.cpp

27
libethereum/State.cpp

@ -1137,6 +1137,12 @@ bool State::isTrieGood(bool _enforceRefs, bool _requireNoLeftOvers) const
ExecutionResult State::execute(LastHashes const& _lh, Transaction const& _t, Permanence _p, OnOpFunc const& _onOp)
{
auto onOp = _onOp;
#if ETH_VMTRACE
if (isChannelVisible<VMTraceChannel>())
onOp = Executive::simpleTrace(); // override tracer
#endif
#if ETH_PARANOIA
paranoia("start of execution.", true);
State old(*this);
@ -1161,16 +1167,11 @@ ExecutionResult State::execute(LastHashes const& _lh, Transaction const& _t, Per
ctrace << toHex(e.t().rlp());
#endif
if (!e.execute())
#if ETH_VMTRACE
{
if (isChannelVisible<VMTraceChannel>())
e.go(e.simpleTrace());
else
e.go(_onOp);
if (onOp)
VMFactory::setKind(VMKind::Interpreter); // force interpreter if a trace is wanted
e.go(onOp);
}
#else
e.go(_onOp);
#endif
e.finalize();
#if ETH_PARANOIA
@ -1183,13 +1184,13 @@ ExecutionResult State::execute(LastHashes const& _lh, Transaction const& _t, Per
else
{
commit();
#if ETH_PARANOIA && !ETH_FATDB
ctrace << "Executed; now" << rootHash();
ctrace << old.diff(*this);
paranoia("after execution commit.", true);
if (e.t().receiveAddress())
{
EnforceRefs r(m_db, true);
@ -1200,9 +1201,9 @@ ExecutionResult State::execute(LastHashes const& _lh, Transaction const& _t, Per
}
}
#endif
// TODO: CHECK TRIE after level DB flush to make sure exactly the same.
// Add to the user-originated transactions that we've executed.
m_transactions.push_back(e.t());
m_receipts.push_back(TransactionReceipt(rootHash(), startGasUsed + e.gasUsed(), e.logs()));

Loading…
Cancel
Save