@@ -141,23 +141,30 @@ BOOST_AUTO_TEST_CASE(multisig_IsStandard)
141
141
for (int i = 0 ; i < 4 ; i++)
142
142
key[i].MakeNewKey (true );
143
143
144
- TxoutType whichType;
144
+ const auto is_standard{[](const CScript& spk) {
145
+ TxoutType type;
146
+ bool res{::IsStandard (spk, std::nullopt, type)};
147
+ if (res) {
148
+ BOOST_CHECK_EQUAL (type, TxoutType::MULTISIG);
149
+ }
150
+ return res;
151
+ }};
145
152
146
153
CScript a_and_b;
147
154
a_and_b << OP_2 << ToByteVector (key[0 ].GetPubKey ()) << ToByteVector (key[1 ].GetPubKey ()) << OP_2 << OP_CHECKMULTISIG;
148
- BOOST_CHECK (:: IsStandard (a_and_b, whichType ));
155
+ BOOST_CHECK (is_standard (a_and_b));
149
156
150
157
CScript a_or_b;
151
158
a_or_b << OP_1 << ToByteVector (key[0 ].GetPubKey ()) << ToByteVector (key[1 ].GetPubKey ()) << OP_2 << OP_CHECKMULTISIG;
152
- BOOST_CHECK (:: IsStandard (a_or_b, whichType ));
159
+ BOOST_CHECK (is_standard (a_or_b));
153
160
154
161
CScript escrow;
155
162
escrow << OP_2 << ToByteVector (key[0 ].GetPubKey ()) << ToByteVector (key[1 ].GetPubKey ()) << ToByteVector (key[2 ].GetPubKey ()) << OP_3 << OP_CHECKMULTISIG;
156
- BOOST_CHECK (:: IsStandard (escrow, whichType ));
163
+ BOOST_CHECK (is_standard (escrow));
157
164
158
165
CScript one_of_four;
159
166
one_of_four << OP_1 << ToByteVector (key[0 ].GetPubKey ()) << ToByteVector (key[1 ].GetPubKey ()) << ToByteVector (key[2 ].GetPubKey ()) << ToByteVector (key[3 ].GetPubKey ()) << OP_4 << OP_CHECKMULTISIG;
160
- BOOST_CHECK (!:: IsStandard (one_of_four, whichType ));
167
+ BOOST_CHECK (!is_standard (one_of_four));
161
168
162
169
CScript malformed[6 ];
163
170
malformed[0 ] << OP_3 << ToByteVector (key[0 ].GetPubKey ()) << ToByteVector (key[1 ].GetPubKey ()) << OP_2 << OP_CHECKMULTISIG;
@@ -167,8 +174,9 @@ BOOST_AUTO_TEST_CASE(multisig_IsStandard)
167
174
malformed[4 ] << OP_1 << ToByteVector (key[0 ].GetPubKey ()) << ToByteVector (key[1 ].GetPubKey ()) << OP_CHECKMULTISIG;
168
175
malformed[5 ] << OP_1 << ToByteVector (key[0 ].GetPubKey ()) << ToByteVector (key[1 ].GetPubKey ());
169
176
170
- for (int i = 0 ; i < 6 ; i++)
171
- BOOST_CHECK (!::IsStandard (malformed[i], whichType));
177
+ for (int i = 0 ; i < 6 ; i++) {
178
+ BOOST_CHECK (!is_standard (malformed[i]));
179
+ }
172
180
}
173
181
174
182
BOOST_AUTO_TEST_CASE (multisig_Sign)
0 commit comments