File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -1571,11 +1571,22 @@ isminetype CWallet::IsMine(const CTxDestination& dest) const
1571
1571
isminetype CWallet::IsMine (const CScript& script) const
1572
1572
{
1573
1573
AssertLockHeld (cs_wallet);
1574
- isminetype result = ISMINE_NO;
1575
- for (const auto & spk_man_pair : m_spk_managers) {
1576
- result = std::max (result, spk_man_pair.second ->IsMine (script));
1574
+
1575
+ // Search the cache so that IsMine is called only on the relevant SPKMs instead of on everything in m_spk_managers
1576
+ const auto & it = m_cached_spks.find (script);
1577
+ if (it != m_cached_spks.end ()) {
1578
+ isminetype res = ISMINE_NO;
1579
+ for (const auto & spkm : it->second ) {
1580
+ res = std::max (res, spkm->IsMine (script));
1581
+ }
1582
+ Assume (res == ISMINE_SPENDABLE);
1583
+ return res;
1577
1584
}
1578
- return result;
1585
+
1586
+ // Legacy wallet
1587
+ if (IsLegacy ()) return GetLegacyScriptPubKeyMan ()->IsMine (script);
1588
+
1589
+ return ISMINE_NO;
1579
1590
}
1580
1591
1581
1592
bool CWallet::IsMine (const CTransaction& tx) const
You can’t perform that action at this time.
0 commit comments