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:
1 parent
b4a49cc727
commit
a9d64cd49c
1 file changed
-8
@@ -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.
|
// Try to top up keypool. No-op if the wallet is locked.
|
||||||
walletInstance->TopUpKeyPool();
|
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)) {
|
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
|
walletInstance->m_chain_notifications_handler.reset(); // Reset this pointer so that the wallet will actually be unloaded
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
Reference in new issue
Block a user