Skip to content

Commit 4c5491f

Browse files
committed
Refactor: Move SetWalletFlag out of LegacyScriptPubKeyMan::UpgradeKeyMetadata
This commit does not change behavior.
1 parent 769acef commit 4c5491f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/wallet/scriptpubkeyman.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,6 @@ void LegacyScriptPubKeyMan::UpgradeKeyMetadata()
320320
}
321321
}
322322
}
323-
batch.reset(); //write before setting the flag
324-
m_storage.SetWalletFlag(WALLET_FLAG_KEY_ORIGIN_METADATA);
325323
}
326324

327325
bool LegacyScriptPubKeyMan::IsHDEnabled() const

src/wallet/wallet.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,15 @@ const CWalletTx* CWallet::GetWalletTx(const uint256& hash) const
249249

250250
void CWallet::UpgradeKeyMetadata()
251251
{
252+
if (IsLocked() || IsWalletFlagSet(WALLET_FLAG_KEY_ORIGIN_METADATA)) {
253+
return;
254+
}
255+
252256
if (m_spk_man) {
253257
AssertLockHeld(m_spk_man->cs_wallet);
254258
m_spk_man->UpgradeKeyMetadata();
255259
}
260+
SetWalletFlag(WALLET_FLAG_KEY_ORIGIN_METADATA);
256261
}
257262

258263
bool CWallet::Unlock(const SecureString& strWalletPassphrase, bool accept_no_keys)

0 commit comments

Comments
 (0)