HomePhabricator

[backport#15931 6/9] Only return early from BlockUntilSyncedToCurrentChain if…

Description

[backport#15931 6/9] Only return early from BlockUntilSyncedToCurrentChain if current tip is exact match

Summary:
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.


https://github.com/bitcoin/bitcoin/pull/15931/commits/f77b1de16feee097a88e99d2ecdd4d84beb4f915

Depends on D7510

Partial backport of Core PR15931

Test Plan:

ninja check check-functional

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D7511

Details

Provenance
Antoine Riard <ariard@student.42.fr>Authored on Jun 24 2019, 23:07
majcostaCommitted on Sep 22 2020, 14:59
majcostaPushed on Sep 22 2020, 14:59
Reviewer
Restricted Project
Differential Revision
D7511: [backport#15931 6/9] Only return early from BlockUntilSyncedToCurrentChain if current tip is exact match
Parents
rABCe2178e2316ae: [backport#15931 5/9] Refactor some importprunedfunds checks with guard clause
Branches
Unknown
Tags
Unknown