Fix maybe-uninitialized warning in IsSpentKey

This commit is contained in:
Ava Chow 2024-08-21 14:06:49 -04:00
parent bc87ad9854
commit 17707db939

View File

@ -1039,21 +1039,20 @@ bool CWallet::IsSpentKey(const CScript& scriptPubKey) const
return true; return true;
} }
LegacyScriptPubKeyMan* spk_man = GetLegacyScriptPubKeyMan(); if (LegacyScriptPubKeyMan* spk_man = GetLegacyScriptPubKeyMan()) {
if (!spk_man) return false; for (const auto& keyid : GetAffectedKeys(scriptPubKey, *spk_man)) {
WitnessV0KeyHash wpkh_dest(keyid);
for (const auto& keyid : GetAffectedKeys(scriptPubKey, *spk_man)) { if (IsAddressPreviouslySpent(wpkh_dest)) {
WitnessV0KeyHash wpkh_dest(keyid); return true;
if (IsAddressPreviouslySpent(wpkh_dest)) { }
return true; ScriptHash sh_wpkh_dest(GetScriptForDestination(wpkh_dest));
} if (IsAddressPreviouslySpent(sh_wpkh_dest)) {
ScriptHash sh_wpkh_dest(GetScriptForDestination(wpkh_dest)); return true;
if (IsAddressPreviouslySpent(sh_wpkh_dest)) { }
return true; PKHash pkh_dest(keyid);
} if (IsAddressPreviouslySpent(pkh_dest)) {
PKHash pkh_dest(keyid); return true;
if (IsAddressPreviouslySpent(pkh_dest)) { }
return true;
} }
} }
return false; return false;