mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
[mempool] Remove NotifyEntryAdded and NotifyEntryRemoved callbacks
NotifyEntryAdded never had any subscribers so can be removed. Since ConnectTrace no longer subscribes to NotifyEntryRemoved, there are now no subscribers. The CValidationInterface TransactionAddedToMempool and TransactionRemovedFromMempool methods can now provide this functionality. There's no need for a special notifications framework for the mempool.
This commit is contained in:
parent
2dd561f361
commit
e57980b473
4 changed files with 4 additions and 8 deletions
|
@ -74,6 +74,7 @@
|
||||||
#include <boost/algorithm/string/classification.hpp>
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <boost/algorithm/string/split.hpp>
|
#include <boost/algorithm/string/split.hpp>
|
||||||
|
#include <boost/signals2/signal.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
#if ENABLE_ZMQ
|
#if ENABLE_ZMQ
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
|
|
||||||
#include <univalue.h>
|
#include <univalue.h>
|
||||||
|
|
||||||
|
#include <boost/signals2/signal.hpp>
|
||||||
|
|
||||||
class CWallet;
|
class CWallet;
|
||||||
fs::path GetWalletDir();
|
fs::path GetWalletDir();
|
||||||
std::vector<fs::path> ListWalletDir();
|
std::vector<fs::path> ListWalletDir();
|
||||||
|
|
|
@ -355,7 +355,6 @@ void CTxMemPool::AddTransactionsUpdated(unsigned int n)
|
||||||
|
|
||||||
void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAncestors, bool validFeeEstimate)
|
void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAncestors, bool validFeeEstimate)
|
||||||
{
|
{
|
||||||
NotifyEntryAdded(entry.GetSharedTx());
|
|
||||||
// Add to memory pool without checking anything.
|
// Add to memory pool without checking anything.
|
||||||
// Used by AcceptToMemoryPool(), which DOES do
|
// Used by AcceptToMemoryPool(), which DOES do
|
||||||
// all the appropriate checks.
|
// all the appropriate checks.
|
||||||
|
@ -406,14 +405,12 @@ void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAnces
|
||||||
|
|
||||||
void CTxMemPool::removeUnchecked(txiter it, MemPoolRemovalReason reason)
|
void CTxMemPool::removeUnchecked(txiter it, MemPoolRemovalReason reason)
|
||||||
{
|
{
|
||||||
CTransactionRef ptx = it->GetSharedTx();
|
|
||||||
NotifyEntryRemoved(ptx, reason);
|
|
||||||
if (reason != MemPoolRemovalReason::BLOCK) {
|
if (reason != MemPoolRemovalReason::BLOCK) {
|
||||||
// Notify clients that a transaction has been removed from the mempool
|
// Notify clients that a transaction has been removed from the mempool
|
||||||
// for any reason except being included in a block. Clients interested
|
// for any reason except being included in a block. Clients interested
|
||||||
// in transactions included in blocks can subscribe to the BlockConnected
|
// in transactions included in blocks can subscribe to the BlockConnected
|
||||||
// notification.
|
// notification.
|
||||||
GetMainSignals().TransactionRemovedFromMempool(ptx);
|
GetMainSignals().TransactionRemovedFromMempool(it->GetSharedTx());
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint256 hash = it->GetTx().GetHash();
|
const uint256 hash = it->GetTx().GetHash();
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include <boost/multi_index/hashed_index.hpp>
|
#include <boost/multi_index/hashed_index.hpp>
|
||||||
#include <boost/multi_index/ordered_index.hpp>
|
#include <boost/multi_index/ordered_index.hpp>
|
||||||
#include <boost/multi_index/sequenced_index.hpp>
|
#include <boost/multi_index/sequenced_index.hpp>
|
||||||
#include <boost/signals2/signal.hpp>
|
|
||||||
|
|
||||||
class CBlockIndex;
|
class CBlockIndex;
|
||||||
extern RecursiveMutex cs_main;
|
extern RecursiveMutex cs_main;
|
||||||
|
@ -699,9 +698,6 @@ public:
|
||||||
|
|
||||||
size_t DynamicMemoryUsage() const;
|
size_t DynamicMemoryUsage() const;
|
||||||
|
|
||||||
boost::signals2::signal<void (CTransactionRef)> NotifyEntryAdded;
|
|
||||||
boost::signals2::signal<void (CTransactionRef, MemPoolRemovalReason)> NotifyEntryRemoved;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** UpdateForDescendants is used by UpdateTransactionsFromBlock to update
|
/** UpdateForDescendants is used by UpdateTransactionsFromBlock to update
|
||||||
* the descendants for a single transaction that has been added to the
|
* the descendants for a single transaction that has been added to the
|
||||||
|
|
Loading…
Add table
Reference in a new issue