@@ -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