interfaces: Add Chain::requestMempoolTransactions
This commit is contained in:
parent
0440481c6b
commit
57908a739c
2 changed files with 17 additions and 0 deletions
|
@ -367,6 +367,13 @@ public:
|
||||||
{
|
{
|
||||||
return MakeUnique<RpcHandlerImpl>(command);
|
return MakeUnique<RpcHandlerImpl>(command);
|
||||||
}
|
}
|
||||||
|
void requestMempoolTransactions(Notifications& notifications) override
|
||||||
|
{
|
||||||
|
LOCK2(::cs_main, ::mempool.cs);
|
||||||
|
for (const CTxMemPoolEntry& entry : ::mempool.mapTx) {
|
||||||
|
notifications.TransactionAddedToMempool(entry.GetSharedTx());
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -269,6 +269,16 @@ public:
|
||||||
//! Register handler for RPC. Command is not copied, so reference
|
//! Register handler for RPC. Command is not copied, so reference
|
||||||
//! needs to remain valid until Handler is disconnected.
|
//! needs to remain valid until Handler is disconnected.
|
||||||
virtual std::unique_ptr<Handler> handleRpc(const CRPCCommand& command) = 0;
|
virtual std::unique_ptr<Handler> handleRpc(const CRPCCommand& command) = 0;
|
||||||
|
|
||||||
|
//! Synchronously send TransactionAddedToMempool notifications about all
|
||||||
|
//! current mempool transactions to the specified handler and return after
|
||||||
|
//! the last one is sent. These notifications aren't coordinated with async
|
||||||
|
//! notifications sent by handleNotifications, so out of date async
|
||||||
|
//! notifications from handleNotifications can arrive during and after
|
||||||
|
//! synchronous notifications from requestMempoolTransactions. Clients need
|
||||||
|
//! to be prepared to handle this by ignoring notifications about unknown
|
||||||
|
//! removed transactions and already added new transactions.
|
||||||
|
virtual void requestMempoolTransactions(Notifications& notifications) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Interface to let node manage chain clients (wallets, or maybe tools for
|
//! Interface to let node manage chain clients (wallets, or maybe tools for
|
||||||
|
|
Loading…
Reference in a new issue