diff options
| author | Antoine Riard <[email protected]> | 2019-06-24 19:07:09 -0400 |
|---|---|---|
| committer | Antoine Riard <[email protected]> | 2019-11-06 13:36:43 -0500 |
| commit | f77b1de16feee097a88e99d2ecdd4d84beb4f915 (patch) | |
| tree | 076310e189e2299c765cd3aa942bbc9c3125628a /src/interfaces/chain.cpp | |
| parent | Refactor some importprunedfunds checks with guard clause (diff) | |
| download | discoin-f77b1de16feee097a88e99d2ecdd4d84beb4f915.tar.xz discoin-f77b1de16feee097a88e99d2ecdd4d84beb4f915.zip | |
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.
Diffstat (limited to 'src/interfaces/chain.cpp')
| -rw-r--r-- | src/interfaces/chain.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp index c2a8faf8c..0635909ca 100644 --- a/src/interfaces/chain.cpp +++ b/src/interfaces/chain.cpp @@ -353,13 +353,11 @@ public: { return MakeUnique<NotificationsHandlerImpl>(*this, notifications); } - void waitForNotificationsIfNewBlocksConnected(const uint256& old_tip) override + void waitForNotificationsIfTipChanged(const uint256& old_tip) override { if (!old_tip.IsNull()) { LOCK(::cs_main); if (old_tip == ::ChainActive().Tip()->GetBlockHash()) return; - CBlockIndex* block = LookupBlockIndex(old_tip); - if (block && block->GetAncestor(::ChainActive().Height()) == ::ChainActive().Tip()) return; } SyncWithValidationInterfaceQueue(); } |