mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02: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:
parent
769ff05e48
commit
f77b1de16f
3 changed files with 4 additions and 7 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue