File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -367,6 +367,13 @@ class ChainImpl : public Chain
367
367
{
368
368
return MakeUnique<RpcHandlerImpl>(command);
369
369
}
370
+ void requestMempoolTransactions (Notifications& notifications) override
371
+ {
372
+ LOCK2 (::cs_main, ::mempool.cs );
373
+ for (const CTxMemPoolEntry& entry : ::mempool.mapTx ) {
374
+ notifications.TransactionAddedToMempool (entry.GetSharedTx ());
375
+ }
376
+ }
370
377
};
371
378
} // namespace
372
379
Original file line number Diff line number Diff line change @@ -269,6 +269,16 @@ class Chain
269
269
// ! Register handler for RPC. Command is not copied, so reference
270
270
// ! needs to remain valid until Handler is disconnected.
271
271
virtual std::unique_ptr<Handler> handleRpc (const CRPCCommand& command) = 0;
272
+
273
+ // ! Synchronously send TransactionAddedToMempool notifications about all
274
+ // ! current mempool transactions to the specified handler and return after
275
+ // ! the last one is sent. These notifications aren't coordinated with async
276
+ // ! notifications sent by handleNotifications, so out of date async
277
+ // ! notifications from handleNotifications can arrive during and after
278
+ // ! synchronous notifications from requestMempoolTransactions. Clients need
279
+ // ! to be prepared to handle this by ignoring notifications about unknown
280
+ // ! removed transactions and already added new transactions.
281
+ virtual void requestMempoolTransactions (Notifications& notifications) = 0;
272
282
};
273
283
274
284
// ! Interface to let node manage chain clients (wallets, or maybe tools for
You can’t perform that action at this time.
0 commit comments