@@ -43,11 +43,13 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
43
43
// Keystore does not have key
44
44
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
45
45
BOOST_CHECK_EQUAL (result, ISMINE_NO);
46
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
46
47
47
48
// Keystore has key
48
49
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddKey (keys[0 ]));
49
50
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
50
51
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
52
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 1 );
51
53
}
52
54
53
55
// P2PK uncompressed
@@ -60,11 +62,13 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
60
62
// Keystore does not have key
61
63
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
62
64
BOOST_CHECK_EQUAL (result, ISMINE_NO);
65
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
63
66
64
67
// Keystore has key
65
68
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddKey (uncompressedKey));
66
69
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
67
70
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
71
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 1 );
68
72
}
69
73
70
74
// P2PKH compressed
@@ -77,11 +81,13 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
77
81
// Keystore does not have key
78
82
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
79
83
BOOST_CHECK_EQUAL (result, ISMINE_NO);
84
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
80
85
81
86
// Keystore has key
82
87
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddKey (keys[0 ]));
83
88
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
84
89
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
90
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 1 );
85
91
}
86
92
87
93
// P2PKH uncompressed
@@ -94,11 +100,13 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
94
100
// Keystore does not have key
95
101
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
96
102
BOOST_CHECK_EQUAL (result, ISMINE_NO);
103
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
97
104
98
105
// Keystore has key
99
106
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddKey (uncompressedKey));
100
107
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
101
108
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
109
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 1 );
102
110
}
103
111
104
112
// P2SH
@@ -113,16 +121,19 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
113
121
// Keystore does not have redeemScript or key
114
122
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
115
123
BOOST_CHECK_EQUAL (result, ISMINE_NO);
124
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
116
125
117
126
// Keystore has redeemScript but no key
118
127
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddCScript (redeemScript));
119
128
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
120
129
BOOST_CHECK_EQUAL (result, ISMINE_NO);
130
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
121
131
122
132
// Keystore has redeemScript and key
123
133
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddKey (keys[0 ]));
124
134
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
125
135
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
136
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 1 );
126
137
}
127
138
128
139
// (P2PKH inside) P2SH inside P2SH (invalid)
@@ -141,6 +152,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
141
152
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddKey (keys[0 ]));
142
153
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
143
154
BOOST_CHECK_EQUAL (result, ISMINE_NO);
155
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
144
156
}
145
157
146
158
// (P2PKH inside) P2SH inside P2WSH (invalid)
@@ -159,6 +171,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
159
171
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddKey (keys[0 ]));
160
172
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
161
173
BOOST_CHECK_EQUAL (result, ISMINE_NO);
174
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
162
175
}
163
176
164
177
// P2WPKH inside P2WSH (invalid)
@@ -175,6 +188,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
175
188
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddKey (keys[0 ]));
176
189
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
177
190
BOOST_CHECK_EQUAL (result, ISMINE_NO);
191
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
178
192
}
179
193
180
194
// (P2PKH inside) P2WSH inside P2WSH (invalid)
@@ -193,6 +207,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
193
207
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddKey (keys[0 ]));
194
208
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
195
209
BOOST_CHECK_EQUAL (result, ISMINE_NO);
210
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
196
211
}
197
212
198
213
// P2WPKH compressed
@@ -208,6 +223,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
208
223
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddCScript (scriptPubKey));
209
224
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
210
225
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
226
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 1 );
211
227
}
212
228
213
229
// P2WPKH uncompressed
@@ -222,11 +238,13 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
222
238
// Keystore has key, but no P2SH redeemScript
223
239
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
224
240
BOOST_CHECK_EQUAL (result, ISMINE_NO);
241
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
225
242
226
243
// Keystore has key and P2SH redeemScript
227
244
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddCScript (scriptPubKey));
228
245
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
229
246
BOOST_CHECK_EQUAL (result, ISMINE_NO);
247
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
230
248
}
231
249
232
250
// scriptPubKey multisig
@@ -240,24 +258,28 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
240
258
// Keystore does not have any keys
241
259
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
242
260
BOOST_CHECK_EQUAL (result, ISMINE_NO);
261
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
243
262
244
263
// Keystore has 1/2 keys
245
264
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddKey (uncompressedKey));
246
265
247
266
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
248
267
BOOST_CHECK_EQUAL (result, ISMINE_NO);
268
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
249
269
250
270
// Keystore has 2/2 keys
251
271
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddKey (keys[1 ]));
252
272
253
273
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
254
274
BOOST_CHECK_EQUAL (result, ISMINE_NO);
275
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
255
276
256
277
// Keystore has 2/2 keys and the script
257
278
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddCScript (scriptPubKey));
258
279
259
280
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
260
281
BOOST_CHECK_EQUAL (result, ISMINE_NO);
282
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
261
283
}
262
284
263
285
// P2SH multisig
@@ -274,11 +296,13 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
274
296
// Keystore has no redeemScript
275
297
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
276
298
BOOST_CHECK_EQUAL (result, ISMINE_NO);
299
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
277
300
278
301
// Keystore has redeemScript
279
302
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddCScript (redeemScript));
280
303
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
281
304
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
305
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 1 );
282
306
}
283
307
284
308
// P2WSH multisig with compressed keys
@@ -295,16 +319,19 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
295
319
// Keystore has keys, but no witnessScript or P2SH redeemScript
296
320
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
297
321
BOOST_CHECK_EQUAL (result, ISMINE_NO);
322
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
298
323
299
324
// Keystore has keys and witnessScript, but no P2SH redeemScript
300
325
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddCScript (witnessScript));
301
326
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
302
327
BOOST_CHECK_EQUAL (result, ISMINE_NO);
328
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
303
329
304
330
// Keystore has keys, witnessScript, P2SH redeemScript
305
331
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddCScript (scriptPubKey));
306
332
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
307
333
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
334
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 1 );
308
335
}
309
336
310
337
// P2WSH multisig with uncompressed key
@@ -321,16 +348,19 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
321
348
// Keystore has keys, but no witnessScript or P2SH redeemScript
322
349
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
323
350
BOOST_CHECK_EQUAL (result, ISMINE_NO);
351
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
324
352
325
353
// Keystore has keys and witnessScript, but no P2SH redeemScript
326
354
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddCScript (witnessScript));
327
355
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
328
356
BOOST_CHECK_EQUAL (result, ISMINE_NO);
357
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
329
358
330
359
// Keystore has keys, witnessScript, P2SH redeemScript
331
360
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddCScript (scriptPubKey));
332
361
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
333
362
BOOST_CHECK_EQUAL (result, ISMINE_NO);
363
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
334
364
}
335
365
336
366
// P2WSH multisig wrapped in P2SH
@@ -346,18 +376,21 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
346
376
// Keystore has no witnessScript, P2SH redeemScript, or keys
347
377
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
348
378
BOOST_CHECK_EQUAL (result, ISMINE_NO);
379
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
349
380
350
381
// Keystore has witnessScript and P2SH redeemScript, but no keys
351
382
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddCScript (redeemScript));
352
383
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddCScript (witnessScript));
353
384
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
354
385
BOOST_CHECK_EQUAL (result, ISMINE_NO);
386
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
355
387
356
388
// Keystore has keys, witnessScript, P2SH redeemScript
357
389
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddKey (keys[0 ]));
358
390
BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->AddKey (keys[1 ]));
359
391
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
360
392
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
393
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 1 );
361
394
}
362
395
363
396
// OP_RETURN
@@ -372,6 +405,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
372
405
373
406
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
374
407
BOOST_CHECK_EQUAL (result, ISMINE_NO);
408
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
375
409
}
376
410
377
411
// witness unspendable
@@ -386,6 +420,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
386
420
387
421
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
388
422
BOOST_CHECK_EQUAL (result, ISMINE_NO);
423
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
389
424
}
390
425
391
426
// witness unknown
@@ -400,6 +435,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
400
435
401
436
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
402
437
BOOST_CHECK_EQUAL (result, ISMINE_NO);
438
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
403
439
}
404
440
405
441
// Nonstandard
@@ -414,6 +450,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
414
450
415
451
result = keystore.GetLegacyScriptPubKeyMan ()->IsMine (scriptPubKey);
416
452
BOOST_CHECK_EQUAL (result, ISMINE_NO);
453
+ BOOST_CHECK (keystore.GetLegacyScriptPubKeyMan ()->GetScriptPubKeys ().count (scriptPubKey) == 0 );
417
454
}
418
455
}
419
456
0 commit comments