mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-02 17:56:16 +00:00
wallet: Remove redundant birth time update
Checking every SPKM in `CWallet::Create()` is not necessary, since the only way presently for an SPKM to get added to `m_spk_managers` (the return value of `GetAllScriptPubKeyMans()`) is through `AddScriptPubKeyMan()`, which already invokes `MaybeUpdateBirthTime()`.
This commit is contained in:
parent
b4a49cc727
commit
a9d64cd49c
@ -3088,14 +3088,6 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
|
||||
// Try to top up keypool. No-op if the wallet is locked.
|
||||
walletInstance->TopUpKeyPool();
|
||||
|
||||
// Cache the first key time
|
||||
std::optional<int64_t> time_first_key;
|
||||
for (auto spk_man : walletInstance->GetAllScriptPubKeyMans()) {
|
||||
int64_t time = spk_man->GetTimeFirstKey();
|
||||
if (!time_first_key || time < *time_first_key) time_first_key = time;
|
||||
}
|
||||
if (time_first_key) walletInstance->MaybeUpdateBirthTime(*time_first_key);
|
||||
|
||||
if (chain && !AttachChain(walletInstance, *chain, rescan_required, error, warnings)) {
|
||||
walletInstance->m_chain_notifications_handler.reset(); // Reset this pointer so that the wallet will actually be unloaded
|
||||
return nullptr;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user