@@ -173,11 +173,14 @@ void DoTest(const CScript& scriptPubKey, const CScript& scriptSig, const CScript
173
173
#if defined(HAVE_CONSENSUS_LIB)
174
174
CDataStream stream (SER_NETWORK, PROTOCOL_VERSION);
175
175
stream << tx2;
176
- if (flags & bitcoinconsensus_SCRIPT_FLAGS_VERIFY_WITNESS) {
177
- BOOST_CHECK_MESSAGE (bitcoinconsensus_verify_script_with_amount (begin_ptr (scriptPubKey), scriptPubKey.size (), txCredit.vout [0 ].nValue , (const unsigned char *)&stream[0 ], stream.size (), 0 , flags, NULL ) == expect, message);
178
- } else {
179
- BOOST_CHECK_MESSAGE (bitcoinconsensus_verify_script_with_amount (begin_ptr (scriptPubKey), scriptPubKey.size (), 0 , (const unsigned char *)&stream[0 ], stream.size (), 0 , flags, NULL ) == expect, message);
180
- BOOST_CHECK_MESSAGE (bitcoinconsensus_verify_script (begin_ptr (scriptPubKey), scriptPubKey.size (), (const unsigned char *)&stream[0 ], stream.size (), 0 , flags, NULL ) == expect,message);
176
+ int libconsensus_flags = flags & bitcoinconsensus_SCRIPT_FLAGS_VERIFY_ALL;
177
+ if (libconsensus_flags == flags) {
178
+ if (flags & bitcoinconsensus_SCRIPT_FLAGS_VERIFY_WITNESS) {
179
+ BOOST_CHECK_MESSAGE (bitcoinconsensus_verify_script_with_amount (begin_ptr (scriptPubKey), scriptPubKey.size (), txCredit.vout [0 ].nValue , (const unsigned char *)&stream[0 ], stream.size (), 0 , libconsensus_flags, NULL ) == expect, message);
180
+ } else {
181
+ BOOST_CHECK_MESSAGE (bitcoinconsensus_verify_script_with_amount (begin_ptr (scriptPubKey), scriptPubKey.size (), 0 , (const unsigned char *)&stream[0 ], stream.size (), 0 , libconsensus_flags, NULL ) == expect, message);
182
+ BOOST_CHECK_MESSAGE (bitcoinconsensus_verify_script (begin_ptr (scriptPubKey), scriptPubKey.size (), (const unsigned char *)&stream[0 ], stream.size (), 0 , libconsensus_flags, NULL ) == expect,message);
183
+ }
181
184
}
182
185
#endif
183
186
}
0 commit comments