Skip to content

Commit

Permalink
wallet: Move LegacyScriptPubKeyMan::IsMine to LegacyDataSPKM
Browse files Browse the repository at this point in the history
IsMine is necessary for migration. It should be inlined with migration
when the legacy wallet is removed.
  • Loading branch information
achow101 committed Jun 24, 2024
1 parent c653f4f commit bbb1d51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/wallet/scriptpubkeyman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ bool HaveKeys(const std::vector<valtype>& pubkeys, const LegacyDataSPKM& keystor
//! scripts or simply treat any script that has been
//! stored in the keystore as spendable
// NOLINTNEXTLINE(misc-no-recursion)
IsMineResult IsMineInner(const LegacyScriptPubKeyMan& keystore, const CScript& scriptPubKey, IsMineSigVersion sigversion, bool recurse_scripthash=true)
IsMineResult IsMineInner(const LegacyDataSPKM& keystore, const CScript& scriptPubKey, IsMineSigVersion sigversion, bool recurse_scripthash=true)
{
IsMineResult ret = IsMineResult::NO;

Expand Down Expand Up @@ -213,7 +213,7 @@ IsMineResult IsMineInner(const LegacyScriptPubKeyMan& keystore, const CScript& s

} // namespace

isminetype LegacyScriptPubKeyMan::IsMine(const CScript& script) const
isminetype LegacyDataSPKM::IsMine(const CScript& script) const
{
switch (IsMineInner(*this, script, IsMineSigVersion::TOP)) {
case IsMineResult::INVALID:
Expand Down
3 changes: 2 additions & 1 deletion src/wallet/scriptpubkeyman.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ class LegacyDataSPKM : public ScriptPubKeyMan, public FillableSigningProvider
std::unordered_set<CScript, SaltedSipHasher> GetScriptPubKeys() const override;
std::unique_ptr<SigningProvider> GetSolvingProvider(const CScript& script) const override;
uint256 GetID() const override { return uint256::ONE; }
// TODO: Remove IsMine when deleting LegacyScriptPubKeyMan
isminetype IsMine(const CScript& script) const override;

// FillableSigningProvider overrides
bool HaveKey(const CKeyID &address) const override;
Expand Down Expand Up @@ -447,7 +449,6 @@ class LegacyScriptPubKeyMan : public LegacyDataSPKM
LegacyScriptPubKeyMan(WalletStorage& storage, int64_t keypool_size) : LegacyDataSPKM(storage), m_keypool_size(keypool_size) {}

util::Result<CTxDestination> GetNewDestination(const OutputType type) override;
isminetype IsMine(const CScript& script) const override;

bool Encrypt(const CKeyingMaterial& master_key, WalletBatch* batch) override;

Expand Down

0 comments on commit bbb1d51

Please sign in to comment.