Skip to content

Commit

Permalink
refactor: Handle first run in CWallet::AttachChain
Browse files Browse the repository at this point in the history
  • Loading branch information
S3RK committed Dec 30, 2020
1 parent b528485 commit b20c1e5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
@@ -3859,8 +3859,6 @@ std::shared_ptr<CWallet> CWallet::Create(interfaces::Chain& chain, const std::st
}
}
}

walletInstance->chainStateFlushed(chain.getTipLocator());
} else if (wallet_creation_flags & WALLET_FLAG_DISABLE_PRIVATE_KEYS) {
// Make it impossible to disable private keys after creation
error = strprintf(_("Error loading %s: Private keys can only be disabled during creation"), walletFile);
@@ -4036,6 +4034,10 @@ CWallet::ScanStatus CWallet::AttachChain(std::shared_ptr<CWallet> wallet, bool s
auto& walletInstance = wallet;
LOCK(walletInstance->cs_wallet);

if (walletInstance->m_first_run) {
walletInstance->chainStateFlushed(chain.getTipLocator());
}

// 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

0 comments on commit b20c1e5

Please sign in to comment.