From f77b1de16feee097a88e99d2ecdd4d84beb4f915 Mon Sep 17 00:00:00 2001 From: Antoine Riard Date: Mon, 24 Jun 2019 19:07:09 -0400 Subject: Only return early from BlockUntilSyncedToCurrentChain if current tip is exact match In the next commit, we start using BlockConnected/BlockDisconnected callbacks to establish tx depth, rather than querying the chain directly. Currently, BlockUntilSyncedToCurrentChain will return early if the best block processed by the wallet is a descendant of the node'tip. That means that in the case of a re-org, it won't wait for the BlockDisconnected callbacks that have been enqueued during the re-org but have not yet been triggered in the wallet. Change BlockUntilSyncedToCurrentChain to only return early if the wallet's m_last_block_processed matches the tip exactly. This ensures that there are no BlockDisconnected or BlockConnected callbacks in-flight. --- src/interfaces/chain.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/interfaces/chain.h') diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h index 4cb2aba2c9..e07ec1b371 100644 --- a/src/interfaces/chain.h +++ b/src/interfaces/chain.h @@ -236,9 +236,8 @@ public: virtual std::unique_ptr handleNotifications(Notifications& notifications) = 0; //! Wait for pending notifications to be processed unless block hash points to the current - //! chain tip, or to a possible descendant of the current chain tip that isn't currently - //! connected. - virtual void waitForNotificationsIfNewBlocksConnected(const uint256& old_tip) = 0; + //! chain tip. + virtual void waitForNotificationsIfTipChanged(const uint256& old_tip) = 0; //! Register handler for RPC. Command is not copied, so reference //! needs to remain valid until Handler is disconnected. -- cgit v1.2.3