@@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
44
44
auto spk_manager = CreateDescriptor (keystore, desc_str, true );
45
45
46
46
scriptPubKey = GetScriptForRawPubKey (pubkeys[0 ]);
47
- result = spk_manager->IsMine (scriptPubKey);
47
+ result = spk_manager->get (). IsMine (scriptPubKey);
48
48
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
49
49
}
50
50
@@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
56
56
auto spk_manager = CreateDescriptor (keystore, desc_str, true );
57
57
58
58
scriptPubKey = GetScriptForRawPubKey (uncompressedPubkey);
59
- result = spk_manager->IsMine (scriptPubKey);
59
+ result = spk_manager->get (). IsMine (scriptPubKey);
60
60
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
61
61
}
62
62
@@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
68
68
auto spk_manager = CreateDescriptor (keystore, desc_str, true );
69
69
70
70
scriptPubKey = GetScriptForDestination (PKHash (pubkeys[0 ]));
71
- result = spk_manager->IsMine (scriptPubKey);
71
+ result = spk_manager->get (). IsMine (scriptPubKey);
72
72
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
73
73
}
74
74
@@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
80
80
auto spk_manager = CreateDescriptor (keystore, desc_str, true );
81
81
82
82
scriptPubKey = GetScriptForDestination (PKHash (uncompressedPubkey));
83
- result = spk_manager->IsMine (scriptPubKey);
83
+ result = spk_manager->get (). IsMine (scriptPubKey);
84
84
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
85
85
}
86
86
@@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
93
93
94
94
CScript redeemScript = GetScriptForDestination (PKHash (pubkeys[0 ]));
95
95
scriptPubKey = GetScriptForDestination (ScriptHash (redeemScript));
96
- result = spk_manager->IsMine (scriptPubKey);
96
+ result = spk_manager->get (). IsMine (scriptPubKey);
97
97
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
98
98
}
99
99
@@ -103,7 +103,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
103
103
std::string desc_str = " sh(sh(" + EncodeSecret (keys[0 ]) + " ))" ;
104
104
105
105
auto spk_manager = CreateDescriptor (keystore, desc_str, false );
106
- BOOST_CHECK_EQUAL ( spk_manager, nullptr );
106
+ BOOST_CHECK (! spk_manager. has_value () );
107
107
}
108
108
109
109
// (P2PKH inside) P2SH inside P2WSH (invalid) - Descriptor
@@ -112,7 +112,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
112
112
std::string desc_str = " wsh(sh(" + EncodeSecret (keys[0 ]) + " ))" ;
113
113
114
114
auto spk_manager = CreateDescriptor (keystore, desc_str, false );
115
- BOOST_CHECK_EQUAL ( spk_manager, nullptr );
115
+ BOOST_CHECK (! spk_manager. has_value () );
116
116
}
117
117
118
118
// P2WPKH inside P2WSH (invalid) - Descriptor
@@ -121,7 +121,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
121
121
std::string desc_str = " wsh(wpkh(" + EncodeSecret (keys[0 ]) + " ))" ;
122
122
123
123
auto spk_manager = CreateDescriptor (keystore, desc_str, false );
124
- BOOST_CHECK_EQUAL ( spk_manager, nullptr );
124
+ BOOST_CHECK (! spk_manager. has_value () );
125
125
}
126
126
127
127
// (P2PKH inside) P2WSH inside P2WSH (invalid) - Descriptor
@@ -130,7 +130,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
130
130
std::string desc_str = " wsh(wsh(" + EncodeSecret (keys[0 ]) + " ))" ;
131
131
132
132
auto spk_manager = CreateDescriptor (keystore, desc_str, false );
133
- BOOST_CHECK_EQUAL ( spk_manager, nullptr );
133
+ BOOST_CHECK (! spk_manager. has_value () );
134
134
}
135
135
136
136
// P2WPKH compressed - Descriptor
@@ -141,7 +141,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
141
141
auto spk_manager = CreateDescriptor (keystore, desc_str, true );
142
142
143
143
scriptPubKey = GetScriptForDestination (WitnessV0KeyHash (pubkeys[0 ]));
144
- result = spk_manager->IsMine (scriptPubKey);
144
+ result = spk_manager->get (). IsMine (scriptPubKey);
145
145
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
146
146
}
147
147
@@ -151,7 +151,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
151
151
std::string desc_str = " wpkh(" + EncodeSecret (uncompressedKey) + " )" ;
152
152
153
153
auto spk_manager = CreateDescriptor (keystore, desc_str, false );
154
- BOOST_CHECK_EQUAL ( spk_manager, nullptr );
154
+ BOOST_CHECK (! spk_manager. has_value () );
155
155
}
156
156
157
157
// scriptPubKey multisig - Descriptor
@@ -162,7 +162,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
162
162
auto spk_manager = CreateDescriptor (keystore, desc_str, true );
163
163
164
164
scriptPubKey = GetScriptForMultisig (2 , {uncompressedPubkey, pubkeys[1 ]});
165
- result = spk_manager->IsMine (scriptPubKey);
165
+ result = spk_manager->get (). IsMine (scriptPubKey);
166
166
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
167
167
}
168
168
@@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
176
176
177
177
CScript redeemScript = GetScriptForMultisig (2 , {uncompressedPubkey, pubkeys[1 ]});
178
178
scriptPubKey = GetScriptForDestination (ScriptHash (redeemScript));
179
- result = spk_manager->IsMine (scriptPubKey);
179
+ result = spk_manager->get (). IsMine (scriptPubKey);
180
180
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
181
181
}
182
182
@@ -190,7 +190,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
190
190
191
191
CScript redeemScript = GetScriptForMultisig (2 , {pubkeys[0 ], pubkeys[1 ]});
192
192
scriptPubKey = GetScriptForDestination (WitnessV0ScriptHash (redeemScript));
193
- result = spk_manager->IsMine (scriptPubKey);
193
+ result = spk_manager->get (). IsMine (scriptPubKey);
194
194
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
195
195
}
196
196
@@ -201,7 +201,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
201
201
std::string desc_str = " wsh(multi(2," + EncodeSecret (uncompressedKey) + " ," + EncodeSecret (keys[1 ]) + " ))" ;
202
202
203
203
auto spk_manager = CreateDescriptor (keystore, desc_str, false );
204
- BOOST_CHECK_EQUAL ( spk_manager, nullptr );
204
+ BOOST_CHECK (! spk_manager. has_value () );
205
205
}
206
206
207
207
// P2WSH multisig wrapped in P2SH - Descriptor
@@ -215,7 +215,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
215
215
CScript witnessScript = GetScriptForMultisig (2 , {pubkeys[0 ], pubkeys[1 ]});
216
216
CScript redeemScript = GetScriptForDestination (WitnessV0ScriptHash (witnessScript));
217
217
scriptPubKey = GetScriptForDestination (ScriptHash (redeemScript));
218
- result = spk_manager->IsMine (scriptPubKey);
218
+ result = spk_manager->get (). IsMine (scriptPubKey);
219
219
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
220
220
}
221
221
@@ -228,28 +228,28 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
228
228
auto spk_manager = CreateDescriptor (keystore, desc_str, true );
229
229
230
230
// Test P2PK
231
- result = spk_manager->IsMine (GetScriptForRawPubKey (pubkeys[0 ]));
231
+ result = spk_manager->get (). IsMine (GetScriptForRawPubKey (pubkeys[0 ]));
232
232
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
233
233
234
234
// Test P2PKH
235
- result = spk_manager->IsMine (GetScriptForDestination (PKHash (pubkeys[0 ])));
235
+ result = spk_manager->get (). IsMine (GetScriptForDestination (PKHash (pubkeys[0 ])));
236
236
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
237
237
238
238
// Test P2SH (combo descriptor does not describe P2SH)
239
239
CScript redeemScript = GetScriptForDestination (PKHash (pubkeys[0 ]));
240
240
scriptPubKey = GetScriptForDestination (ScriptHash (redeemScript));
241
- result = spk_manager->IsMine (scriptPubKey);
241
+ result = spk_manager->get (). IsMine (scriptPubKey);
242
242
BOOST_CHECK_EQUAL (result, ISMINE_NO);
243
243
244
244
// Test P2WPKH
245
245
scriptPubKey = GetScriptForDestination (WitnessV0KeyHash (pubkeys[0 ]));
246
- result = spk_manager->IsMine (scriptPubKey);
246
+ result = spk_manager->get (). IsMine (scriptPubKey);
247
247
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
248
248
249
249
// P2SH-P2WPKH output
250
250
redeemScript = GetScriptForDestination (WitnessV0KeyHash (pubkeys[0 ]));
251
251
scriptPubKey = GetScriptForDestination (ScriptHash (redeemScript));
252
- result = spk_manager->IsMine (scriptPubKey);
252
+ result = spk_manager->get (). IsMine (scriptPubKey);
253
253
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
254
254
255
255
// Test P2TR (combo descriptor does not describe P2TR)
@@ -259,7 +259,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
259
259
builder.Finalize (xpk);
260
260
WitnessV1Taproot output = builder.GetOutput ();
261
261
scriptPubKey = GetScriptForDestination (output);
262
- result = spk_manager->IsMine (scriptPubKey);
262
+ result = spk_manager->get (). IsMine (scriptPubKey);
263
263
BOOST_CHECK_EQUAL (result, ISMINE_NO);
264
264
}
265
265
@@ -277,7 +277,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard)
277
277
builder.Finalize (xpk);
278
278
WitnessV1Taproot output = builder.GetOutput ();
279
279
scriptPubKey = GetScriptForDestination (output);
280
- result = spk_manager->IsMine (scriptPubKey);
280
+ result = spk_manager->get (). IsMine (scriptPubKey);
281
281
BOOST_CHECK_EQUAL (result, ISMINE_SPENDABLE);
282
282
}
283
283
}
0 commit comments