Skip to content

Commit ea1ab39

Browse files
committed
scriptpubkeyman: Implement GetScriptPubKeys in Legacy
1 parent e664af2 commit ea1ab39

File tree

3 files changed

+98
-4
lines changed

3 files changed

+98
-4
lines changed

src/wallet/scriptpubkeyman.cpp

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,6 +1658,59 @@ std::set<CKeyID> LegacyScriptPubKeyMan::GetKeys() const
16581658
return set_address;
16591659
}
16601660

1661+
const std::unordered_set<CScript, SaltedSipHasher> LegacyScriptPubKeyMan::GetScriptPubKeys() const
1662+
{
1663+
LOCK(cs_KeyStore);
1664+
std::unordered_set<CScript, SaltedSipHasher> spks;
1665+
1666+
// All keys have at least P2PK and P2PKH
1667+
for (const auto& key_pair : mapKeys) {
1668+
const CPubKey& pub = key_pair.second.GetPubKey();
1669+
spks.insert(GetScriptForRawPubKey(pub));
1670+
spks.insert(GetScriptForDestination(PKHash(pub)));
1671+
}
1672+
for (const auto& key_pair : mapCryptedKeys) {
1673+
const CPubKey& pub = key_pair.second.first;
1674+
spks.insert(GetScriptForRawPubKey(pub));
1675+
spks.insert(GetScriptForDestination(PKHash(pub)));
1676+
}
1677+
1678+
// For every script in mapScript, only the ISMINE_SPENDABLE ones are being tracked.
1679+
// The watchonly ones will be in setWatchOnly which we deal with later
1680+
// For all keys, if they have segwit scripts, those scripts will end up in mapScripts
1681+
for (const auto& script_pair : mapScripts) {
1682+
const CScript& script = script_pair.second;
1683+
if (IsMine(script) == ISMINE_SPENDABLE) {
1684+
// Add ScriptHash for scripts that are not already P2SH
1685+
if (!script.IsPayToScriptHash()) {
1686+
spks.insert(GetScriptForDestination(ScriptHash(script)));
1687+
}
1688+
// For segwit scripts, we only consider them spendable if we have the segwit spk
1689+
int wit_ver = -1;
1690+
std::vector<unsigned char> witprog;
1691+
if (script.IsWitnessProgram(wit_ver, witprog) && wit_ver == 0) {
1692+
spks.insert(script);
1693+
}
1694+
} else {
1695+
// Multisigs are special. They don't show up as ISMINE_SPENDABLE unless they are in a P2SH
1696+
// So check the P2SH of a multisig to see if we should insert it
1697+
std::vector<std::vector<unsigned char>> sols;
1698+
TxoutType type = Solver(script, sols);
1699+
if (type == TxoutType::MULTISIG) {
1700+
CScript ms_spk = GetScriptForDestination(ScriptHash(script));
1701+
if (IsMine(ms_spk) != ISMINE_NO) {
1702+
spks.insert(ms_spk);
1703+
}
1704+
}
1705+
}
1706+
}
1707+
1708+
// All watchonly scripts are raw
1709+
spks.insert(setWatchOnly.begin(), setWatchOnly.end());
1710+
1711+
return spks;
1712+
}
1713+
16611714
util::Result<CTxDestination> DescriptorScriptPubKeyMan::GetNewDestination(const OutputType type)
16621715
{
16631716
// Returns true if this descriptor supports getting new addresses. Conditions where we may be unable to fetch them (e.g. locked) are caught later
@@ -2327,14 +2380,14 @@ const WalletDescriptor DescriptorScriptPubKeyMan::GetWalletDescriptor() const
23272380
return m_wallet_descriptor;
23282381
}
23292382

2330-
const std::vector<CScript> DescriptorScriptPubKeyMan::GetScriptPubKeys() const
2383+
const std::unordered_set<CScript, SaltedSipHasher> DescriptorScriptPubKeyMan::GetScriptPubKeys() const
23312384
{
23322385
LOCK(cs_desc_man);
2333-
std::vector<CScript> script_pub_keys;
2386+
std::unordered_set<CScript, SaltedSipHasher> script_pub_keys;
23342387
script_pub_keys.reserve(m_map_script_pub_keys.size());
23352388

23362389
for (auto const& script_pub_key: m_map_script_pub_keys) {
2337-
script_pub_keys.push_back(script_pub_key.first);
2390+
script_pub_keys.insert(script_pub_key.first);
23382391
}
23392392
return script_pub_keys;
23402393
}

src/wallet/scriptpubkeyman.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@ class ScriptPubKeyMan
242242

243243
virtual uint256 GetID() const { return uint256(); }
244244

245+
/** Returns a set of all the scriptPubKeys that this ScriptPubKeyMan watches */
246+
virtual const std::unordered_set<CScript, SaltedSipHasher> GetScriptPubKeys() const { return {}; };
247+
245248
/** Prepends the wallet name in logging output to ease debugging in multi-wallet use cases */
246249
template<typename... Params>
247250
void WalletLogPrintf(std::string fmt, Params... parameters) const {
@@ -507,6 +510,7 @@ class LegacyScriptPubKeyMan : public ScriptPubKeyMan, public FillableSigningProv
507510
const std::map<CKeyID, int64_t>& GetAllReserveKeys() const { return m_pool_key_to_index; }
508511

509512
std::set<CKeyID> GetKeys() const override;
513+
const std::unordered_set<CScript, SaltedSipHasher> GetScriptPubKeys() const override;
510514
};
511515

512516
/** Wraps a LegacyScriptPubKeyMan so that it can be returned in a new unique_ptr. Does not provide privkeys */
@@ -630,7 +634,7 @@ class DescriptorScriptPubKeyMan : public ScriptPubKeyMan
630634
void WriteDescriptor();
631635

632636
const WalletDescriptor GetWalletDescriptor() const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man);
633-
const std::vector<CScript> GetScriptPubKeys() const;
637+
const std::unordered_set<CScript, SaltedSipHasher> GetScriptPubKeys() const override;
634638

635639
bool GetDescriptorString(std::string& out, const bool priv) const;
636640

src/wallet/test/ismine_tests.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
4343
// Keystore does not have key
4444
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
4545
BOOST_CHECK_EQUAL(result, ISMINE_NO);
46+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
4647

4748
// Keystore has key
4849
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
4950
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
5051
BOOST_CHECK_EQUAL(result, ISMINE_SPENDABLE);
52+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 1);
5153
}
5254

5355
// P2PK uncompressed
@@ -60,11 +62,13 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
6062
// Keystore does not have key
6163
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
6264
BOOST_CHECK_EQUAL(result, ISMINE_NO);
65+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
6366

6467
// Keystore has key
6568
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
6669
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
6770
BOOST_CHECK_EQUAL(result, ISMINE_SPENDABLE);
71+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 1);
6872
}
6973

7074
// P2PKH compressed
@@ -77,11 +81,13 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
7781
// Keystore does not have key
7882
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
7983
BOOST_CHECK_EQUAL(result, ISMINE_NO);
84+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
8085

8186
// Keystore has key
8287
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
8388
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
8489
BOOST_CHECK_EQUAL(result, ISMINE_SPENDABLE);
90+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 1);
8591
}
8692

8793
// P2PKH uncompressed
@@ -94,11 +100,13 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
94100
// Keystore does not have key
95101
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
96102
BOOST_CHECK_EQUAL(result, ISMINE_NO);
103+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
97104

98105
// Keystore has key
99106
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
100107
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
101108
BOOST_CHECK_EQUAL(result, ISMINE_SPENDABLE);
109+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 1);
102110
}
103111

104112
// P2SH
@@ -113,16 +121,19 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
113121
// Keystore does not have redeemScript or key
114122
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
115123
BOOST_CHECK_EQUAL(result, ISMINE_NO);
124+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
116125

117126
// Keystore has redeemScript but no key
118127
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(redeemScript));
119128
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
120129
BOOST_CHECK_EQUAL(result, ISMINE_NO);
130+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
121131

122132
// Keystore has redeemScript and key
123133
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
124134
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
125135
BOOST_CHECK_EQUAL(result, ISMINE_SPENDABLE);
136+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 1);
126137
}
127138

128139
// (P2PKH inside) P2SH inside P2SH (invalid)
@@ -141,6 +152,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
141152
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
142153
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
143154
BOOST_CHECK_EQUAL(result, ISMINE_NO);
155+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
144156
}
145157

146158
// (P2PKH inside) P2SH inside P2WSH (invalid)
@@ -159,6 +171,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
159171
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
160172
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
161173
BOOST_CHECK_EQUAL(result, ISMINE_NO);
174+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
162175
}
163176

164177
// P2WPKH inside P2WSH (invalid)
@@ -175,6 +188,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
175188
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
176189
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
177190
BOOST_CHECK_EQUAL(result, ISMINE_NO);
191+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
178192
}
179193

180194
// (P2PKH inside) P2WSH inside P2WSH (invalid)
@@ -193,6 +207,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
193207
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
194208
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
195209
BOOST_CHECK_EQUAL(result, ISMINE_NO);
210+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
196211
}
197212

198213
// P2WPKH compressed
@@ -208,6 +223,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
208223
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(scriptPubKey));
209224
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
210225
BOOST_CHECK_EQUAL(result, ISMINE_SPENDABLE);
226+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 1);
211227
}
212228

213229
// P2WPKH uncompressed
@@ -222,11 +238,13 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
222238
// Keystore has key, but no P2SH redeemScript
223239
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
224240
BOOST_CHECK_EQUAL(result, ISMINE_NO);
241+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
225242

226243
// Keystore has key and P2SH redeemScript
227244
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(scriptPubKey));
228245
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
229246
BOOST_CHECK_EQUAL(result, ISMINE_NO);
247+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
230248
}
231249

232250
// scriptPubKey multisig
@@ -240,24 +258,28 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
240258
// Keystore does not have any keys
241259
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
242260
BOOST_CHECK_EQUAL(result, ISMINE_NO);
261+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
243262

244263
// Keystore has 1/2 keys
245264
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey));
246265

247266
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
248267
BOOST_CHECK_EQUAL(result, ISMINE_NO);
268+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
249269

250270
// Keystore has 2/2 keys
251271
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[1]));
252272

253273
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
254274
BOOST_CHECK_EQUAL(result, ISMINE_NO);
275+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
255276

256277
// Keystore has 2/2 keys and the script
257278
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(scriptPubKey));
258279

259280
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
260281
BOOST_CHECK_EQUAL(result, ISMINE_NO);
282+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
261283
}
262284

263285
// P2SH multisig
@@ -274,11 +296,13 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
274296
// Keystore has no redeemScript
275297
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
276298
BOOST_CHECK_EQUAL(result, ISMINE_NO);
299+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
277300

278301
// Keystore has redeemScript
279302
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(redeemScript));
280303
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
281304
BOOST_CHECK_EQUAL(result, ISMINE_SPENDABLE);
305+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 1);
282306
}
283307

284308
// P2WSH multisig with compressed keys
@@ -295,16 +319,19 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
295319
// Keystore has keys, but no witnessScript or P2SH redeemScript
296320
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
297321
BOOST_CHECK_EQUAL(result, ISMINE_NO);
322+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
298323

299324
// Keystore has keys and witnessScript, but no P2SH redeemScript
300325
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(witnessScript));
301326
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
302327
BOOST_CHECK_EQUAL(result, ISMINE_NO);
328+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
303329

304330
// Keystore has keys, witnessScript, P2SH redeemScript
305331
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(scriptPubKey));
306332
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
307333
BOOST_CHECK_EQUAL(result, ISMINE_SPENDABLE);
334+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 1);
308335
}
309336

310337
// P2WSH multisig with uncompressed key
@@ -321,16 +348,19 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
321348
// Keystore has keys, but no witnessScript or P2SH redeemScript
322349
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
323350
BOOST_CHECK_EQUAL(result, ISMINE_NO);
351+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
324352

325353
// Keystore has keys and witnessScript, but no P2SH redeemScript
326354
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(witnessScript));
327355
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
328356
BOOST_CHECK_EQUAL(result, ISMINE_NO);
357+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
329358

330359
// Keystore has keys, witnessScript, P2SH redeemScript
331360
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(scriptPubKey));
332361
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
333362
BOOST_CHECK_EQUAL(result, ISMINE_NO);
363+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
334364
}
335365

336366
// P2WSH multisig wrapped in P2SH
@@ -346,18 +376,21 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
346376
// Keystore has no witnessScript, P2SH redeemScript, or keys
347377
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
348378
BOOST_CHECK_EQUAL(result, ISMINE_NO);
379+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
349380

350381
// Keystore has witnessScript and P2SH redeemScript, but no keys
351382
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(redeemScript));
352383
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(witnessScript));
353384
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
354385
BOOST_CHECK_EQUAL(result, ISMINE_NO);
386+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
355387

356388
// Keystore has keys, witnessScript, P2SH redeemScript
357389
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0]));
358390
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[1]));
359391
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
360392
BOOST_CHECK_EQUAL(result, ISMINE_SPENDABLE);
393+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 1);
361394
}
362395

363396
// OP_RETURN
@@ -372,6 +405,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
372405

373406
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
374407
BOOST_CHECK_EQUAL(result, ISMINE_NO);
408+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
375409
}
376410

377411
// witness unspendable
@@ -386,6 +420,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
386420

387421
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
388422
BOOST_CHECK_EQUAL(result, ISMINE_NO);
423+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
389424
}
390425

391426
// witness unknown
@@ -400,6 +435,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
400435

401436
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
402437
BOOST_CHECK_EQUAL(result, ISMINE_NO);
438+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
403439
}
404440

405441
// Nonstandard
@@ -414,6 +450,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
414450

415451
result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey);
416452
BOOST_CHECK_EQUAL(result, ISMINE_NO);
453+
BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->GetScriptPubKeys().count(scriptPubKey) == 0);
417454
}
418455
}
419456

0 commit comments

Comments
 (0)