No description provided.
wallet: Some cleanups around LegacyScriptPubKeyMan #20580
pull promag wants to merge 3 commits into bitcoin:master from promag:2020-12-wallet-legacy changing 2 files +8 −15-
promag commented at 7:09 PM on December 5, 2020: member
-
wallet: Simplify CWallet::IsLegacy caf68e292c
-
wallet: Avoid IsLegacy before GetLegacyScriptPubKeyMan fcd2bd3e13
-
wallet: Use const LegacyScriptPubKeyMan 0fe4d02b09
- promag force-pushed on Dec 5, 2020
- DrahtBot added the label Wallet on Dec 5, 2020
- fanquake requested review from achow101 on Dec 5, 2020
-
in src/wallet/wallet.cpp:4475 in caf68e292c outdated
4471 | @@ -4472,11 +4472,7 @@ void CWallet::LoadActiveScriptPubKeyMan(uint256 id, OutputType type, bool intern 4472 | 4473 | bool CWallet::IsLegacy() const 4474 | { 4475 | - if (m_internal_spk_managers.count(OutputType::LEGACY) == 0) { 4476 | - return false; 4477 | - } 4478 | - auto spk_man = dynamic_cast<LegacyScriptPubKeyMan*>(m_internal_spk_managers.at(OutputType::LEGACY)); 4479 | - return spk_man != nullptr; 4480 | + return (m_internal_spk_managers.count(OutputType::LEGACY) == 1);
achow101 commented at 10:41 PM on December 5, 2020:This change is simply incorrect. The original checked for
LegacyScriptPubKeyMan. This now just checks for the presence of aScriptPubKeyManthat provides legacy change addresses. That is completely not what this is for.OutputType::LEGACYis unrelated toLegacyScriptPubKeyMan, this could have usedOutputType::BECH32and not been any different.
promag commented at 11:08 PM on December 5, 2020:Got it, now I understand the reason of the cast. But ATM all
m_internal_spk_managersare the sameLegacyScriptPubKeyManinstance right?
achow101 commented at 12:11 AM on December 6, 2020:But ATM all
m_internal_spk_managersare the sameLegacyScriptPubKeyManinstance right?Only for legacy wallets. For legacy wallets, there's only one
ScriptPubKeyManfor allspk_managers.However for descriptor wallets, there are multiple
DescriptorScriptPubKeyMans. This change is incorrect for descriptor wallets.achow101 commented at 10:44 PM on December 5, 2020: memberTend to NACK.
Besides the 1st commit being completely incorrect, I don't really see the point. It cleans up a little bit but the stuff that is already there isn't currently confusing. Furthermore, the change to
autoin the 3rd commit actually makes it slightly less clear about the type.promag commented at 11:21 PM on December 5, 2020: memberIt cleans up a little bit but the stuff that is already there isn't currently confusing.
The point was to avoid double checking
m_internal_spk_managers, not because it's confusing.Furthermore, the change to auto in the 3rd commit actually makes it slightly less clear about the type.
Kind of, but the idea was not to use
auto, but to make itconst.Thanks @achow101 for reviewing. I'll hold on these nits if something else comes up.
promag closed this on Dec 5, 2020promag deleted the branch on Dec 5, 2020DrahtBot locked this on Feb 15, 2022
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 15:14 UTC
More mirrored repositories can be found on mirror.b10c.me