mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
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.
This commit is contained in:
@@ -1113,7 +1113,7 @@ void CWallet::BlockUntilSyncedToCurrentChain() {
|
||||
// for the queue to drain enough to execute it (indicating we are caught up
|
||||
// at least with the time we entered this function).
|
||||
uint256 last_block_hash = WITH_LOCK(cs_wallet, return m_last_block_processed);
|
||||
chain().waitForNotificationsIfNewBlocksConnected(last_block_hash);
|
||||
chain().waitForNotificationsIfTipChanged(last_block_hash);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user