mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge c4b46b4589 into merged_master (Bitcoin PR bitcoin/bitcoin#31629)
This commit is contained in:
commit
02debdd5fa
1 changed files with 14 additions and 6 deletions
|
|
@ -2099,6 +2099,14 @@ CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_bloc
|
|||
if (max_height && block_height >= *max_height) {
|
||||
break;
|
||||
}
|
||||
// If rescanning was triggered with cs_wallet permanently locked (AttachChain), additional blocks that were connected during the rescan
|
||||
// aren't processed here but will be processed with the pending blockConnected notifications after the lock is released.
|
||||
// If rescanning without a permanent cs_wallet lock, additional blocks that were added during the rescan will be re-processed if
|
||||
// the notification was processed and the last block height was updated.
|
||||
if (block_height >= WITH_LOCK(cs_wallet, return GetLastBlockHeight())) {
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
if (!next_block) {
|
||||
// break successfully when rescan has reached the tip, or
|
||||
|
|
@ -3698,12 +3706,12 @@ bool CWallet::AttachChain(const std::shared_ptr<CWallet>& walletInstance, interf
|
|||
}
|
||||
|
||||
// Register wallet with validationinterface. It's done before rescan to avoid
|
||||
// missing block connections between end of rescan and validation subscribing.
|
||||
// Because of wallet lock being hold, block connection notifications are going to
|
||||
// be pending on the validation-side until lock release. It's likely to have
|
||||
// block processing duplicata (if rescan block range overlaps with notification one)
|
||||
// but we guarantee at least than wallet state is correct after notifications delivery.
|
||||
// However, chainStateFlushed notifications are ignored until the rescan is finished
|
||||
// missing block connections during the rescan.
|
||||
// Because of the wallet lock being held, block connection notifications are going to
|
||||
// be pending on the validation-side until lock release. Blocks that are connected while the
|
||||
// rescan is ongoing will not be processed in the rescan but with the block connected notifications,
|
||||
// so the wallet will only be completeley synced after the notifications delivery.
|
||||
// chainStateFlushed notifications are ignored until the rescan is finished
|
||||
// so that in case of a shutdown event, the rescan will be repeated at the next start.
|
||||
// This is temporary until rescan and notifications delivery are unified under same
|
||||
// interface.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue