mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-05 19:26:17 +00:00
interfaces: Add waitForNotifications() to call SyncWithValidationInterfaceQueue()
Co-Authored-By: stickies-v <stickies-v@protonmail.com>
This commit is contained in:
parent
ce6898f9a8
commit
52992ebe1c
@ -326,12 +326,18 @@ public:
|
||||
};
|
||||
|
||||
//! Register handler for notifications.
|
||||
//! Some notifications are asynchronous and may still execute after the handler is disconnected.
|
||||
//! Use waitForNotifications() after the handler is disconnected to ensure all pending notifications
|
||||
//! have been processed.
|
||||
virtual std::unique_ptr<Handler> handleNotifications(std::shared_ptr<Notifications> notifications) = 0;
|
||||
|
||||
//! Wait for pending notifications to be processed unless block hash points to the current
|
||||
//! chain tip.
|
||||
virtual void waitForNotificationsIfTipChanged(const uint256& old_tip) = 0;
|
||||
|
||||
//! Wait for all pending notifications up to this point to be processed
|
||||
virtual void waitForNotifications() = 0;
|
||||
|
||||
//! Register handler for RPC. Command is not copied, so reference
|
||||
//! needs to remain valid until Handler is disconnected.
|
||||
virtual std::unique_ptr<Handler> handleRpc(const CRPCCommand& command) = 0;
|
||||
|
||||
@ -785,6 +785,10 @@ public:
|
||||
if (!old_tip.IsNull() && old_tip == WITH_LOCK(::cs_main, return chainman().ActiveChain().Tip()->GetBlockHash())) return;
|
||||
validation_signals().SyncWithValidationInterfaceQueue();
|
||||
}
|
||||
void waitForNotifications() override
|
||||
{
|
||||
validation_signals().SyncWithValidationInterfaceQueue();
|
||||
}
|
||||
std::unique_ptr<Handler> handleRpc(const CRPCCommand& command) override
|
||||
{
|
||||
return std::make_unique<RpcHandlerImpl>(command);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user