Browse Source

More exception information when no block info available.

Favour more expensive transactions.
cl-refactor
Gav Wood 10 years ago
parent
commit
7b5c971023
  1. 1
      libethcore/Common.h
  2. 3
      libethereum/Client.cpp
  3. 20
      libethereum/TransactionQueue.cpp

1
libethcore/Common.h

@ -112,6 +112,7 @@ enum class ImportResult
AlreadyInChain,
AlreadyKnown,
Malformed,
OverbidGasPrice,
BadChain
};

3
libethereum/Client.cpp

@ -105,7 +105,8 @@ void Client::onBadBlock(Exception& _ex) const
bytes const* block = boost::get_error_info<errinfo_block>(_ex);
if (!block)
{
cwarn << "ODD: onBadBlock called but exception has no block in it.";
cwarn << "ODD: onBadBlock called but exception (" << _ex.what() << ") has no block in it.";
cwarn << boost::diagnostic_information(_ex, true);
return;
}

20
libethereum/TransactionQueue.cpp

@ -113,6 +113,26 @@ ImportResult TransactionQueue::manageImport_WITH_LOCK(h256 const& _h, Transactio
// If it doesn't work, the signature is bad.
// The transaction's nonce may yet be invalid (or, it could be "valid" but we may be missing a marginally older transaction).
auto r = m_senders.equal_range(_transaction.from());
for (auto it = r.first; it != r.second; ++it)
if (m_current.count(it->second) && m_current[it->second].nonce() == _transaction.nonce())
if (_transaction.gasPrice() < m_current[it->second].gasPrice())
return ImportResult::OverbidGasPrice;
else
{
remove_WITH_LOCK(it->second);
break;
}
else if (m_future.count(it->second) && m_future[it->second].nonce() == _transaction.nonce())
if (_transaction.gasPrice() < m_future[it->second].gasPrice())
return ImportResult::OverbidGasPrice;
else
{
remove_WITH_LOCK(it->second);
break;
}
else {}
// If valid, append to blocks.
insertCurrent_WITH_LOCK(make_pair(_h, _transaction));
m_known.insert(_h);

Loading…
Cancel
Save