Browse Source

Call TransactionRemovedFromMempool in the CScheduler thread

This is both good practice (we want to move all such callbacks
into a background thread eventually) and prevents a lock inversion
when we go to use this in wallet (mempool.cs->cs_wallet and
cs_wallet->mempool.cs would otherwise both be used).
0.16
Matt Corallo 8 years ago
parent
commit
0343676ce3
  1. 2
      src/validationinterface.cpp
  2. 2
      src/validationinterface.h

2
src/validationinterface.cpp

@ -106,7 +106,9 @@ void UnregisterAllValidationInterfaces() { @@ -106,7 +106,9 @@ void UnregisterAllValidationInterfaces() {
void CMainSignals::MempoolEntryRemoved(CTransactionRef ptx, MemPoolRemovalReason reason) {
if (reason != MemPoolRemovalReason::BLOCK && reason != MemPoolRemovalReason::CONFLICT) {
m_internals->m_schedulerClient.AddToProcessQueue([ptx, this] {
m_internals->TransactionRemovedFromMempool(ptx);
});
}
}

2
src/validationinterface.h

@ -45,6 +45,8 @@ protected: @@ -45,6 +45,8 @@ protected:
* size limiting, reorg (changes in lock times/coinbase maturity), or
* replacement. This does not include any transactions which are included
* in BlockConnectedDisconnected either in block->vtx or in txnConflicted.
*
* Called on a background thread.
*/
virtual void TransactionRemovedFromMempool(const CTransactionRef &ptx) {}
/**

Loading…
Cancel
Save