Browse Source

fixed m_known handling

cl-refactor
arkpar 10 years ago
parent
commit
bf5156bcd6
  1. 6
      libethereum/TransactionQueue.cpp

6
libethereum/TransactionQueue.cpp

@ -33,6 +33,7 @@ const char* TransactionQueueTraceChannel::name() { return EthCyan " ┅▶"; }
ImportResult TransactionQueue::import(bytesConstRef _transactionRLP, ImportCallback const& _cb, IfDropped _ik) ImportResult TransactionQueue::import(bytesConstRef _transactionRLP, ImportCallback const& _cb, IfDropped _ik)
{ {
m_limit = 256;
// Check if we already know this transaction. // Check if we already know this transaction.
h256 h = sha3(_transactionRLP); h256 h = sha3(_transactionRLP);
@ -151,7 +152,6 @@ ImportResult TransactionQueue::manageImport_WITH_LOCK(h256 const& _h, Transactio
} }
// If valid, append to blocks. // If valid, append to blocks.
insertCurrent_WITH_LOCK(make_pair(_h, _transaction)); insertCurrent_WITH_LOCK(make_pair(_h, _transaction));
m_known.insert(_h);
if (_cb) if (_cb)
m_callbacks[_h] = _cb; m_callbacks[_h] = _cb;
clog(TransactionQueueTraceChannel) << "Queued vaguely legit-looking transaction" << _h; clog(TransactionQueueTraceChannel) << "Queued vaguely legit-looking transaction" << _h;
@ -236,6 +236,7 @@ void TransactionQueue::insertCurrent_WITH_LOCK(std::pair<h256, Transaction> cons
m_future.erase(t.from()); m_future.erase(t.from());
} }
} }
m_known.insert(_p.first);
} }
bool TransactionQueue::remove_WITH_LOCK(h256 const& _txHash) bool TransactionQueue::remove_WITH_LOCK(h256 const& _txHash)
@ -252,6 +253,7 @@ bool TransactionQueue::remove_WITH_LOCK(h256 const& _txHash)
m_currentByHash.erase(t); m_currentByHash.erase(t);
if (it->second.empty()) if (it->second.empty())
m_currentByAddressAndNonce.erase(it); m_currentByAddressAndNonce.erase(it);
m_known.erase(_txHash);
return true; return true;
} }
@ -304,9 +306,9 @@ void TransactionQueue::drop(h256 const& _txHash)
UpgradeGuard ul(l); UpgradeGuard ul(l);
m_dropped.insert(_txHash); m_dropped.insert(_txHash);
m_known.erase(_txHash);
remove_WITH_LOCK(_txHash); remove_WITH_LOCK(_txHash);
} }
void TransactionQueue::clear() void TransactionQueue::clear()

Loading…
Cancel
Save