Skip to content

Commit 7dfabdc

Browse files
committed
tests: test both settings for permitbaremultisig in p2sh tests
1 parent 96ec3b6 commit 7dfabdc

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/test/script_p2sh_tests.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@
1818
#include <boost/test/unit_test.hpp>
1919

2020
// Helpers:
21+
static bool IsStandardTx(const CTransaction& tx, bool permit_bare_multisig, std::string& reason)
22+
{
23+
return IsStandardTx(tx, std::nullopt, permit_bare_multisig, CFeeRate{DUST_RELAY_TX_FEE}, reason);
24+
}
25+
2126
static bool IsStandardTx(const CTransaction& tx, std::string& reason)
2227
{
23-
return IsStandardTx(tx, std::nullopt, DEFAULT_PERMIT_BAREMULTISIG, CFeeRate{DUST_RELAY_TX_FEE}, reason);
28+
return IsStandardTx(tx, std::nullopt, /*permit_bare_multisig=*/true, CFeeRate{DUST_RELAY_TX_FEE}, reason) &&
29+
IsStandardTx(tx, std::nullopt, /*permit_bare_multisig=*/false, CFeeRate{DUST_RELAY_TX_FEE}, reason);
2430
}
2531

2632
static std::vector<unsigned char> Serialize(const CScript& s)
@@ -201,7 +207,9 @@ BOOST_AUTO_TEST_CASE(set)
201207
{
202208
SignatureData empty;
203209
BOOST_CHECK_MESSAGE(SignSignature(keystore, CTransaction(txFrom), txTo[i], 0, SIGHASH_ALL, empty), strprintf("SignSignature %d", i));
204-
BOOST_CHECK_MESSAGE(IsStandardTx(CTransaction(txTo[i]), reason), strprintf("txTo[%d].IsStandard", i));
210+
BOOST_CHECK_MESSAGE(IsStandardTx(CTransaction(txTo[i]), /*permit_bare_multisig=*/true, reason), strprintf("txTo[%d].IsStandard", i));
211+
bool no_pbms_is_std = IsStandardTx(CTransaction(txTo[i]), /*permit_bare_multisig=*/false, reason);
212+
BOOST_CHECK_MESSAGE((i == 0 ? no_pbms_is_std : !no_pbms_is_std), strprintf("txTo[%d].IsStandard(permbaremulti=false)", i));
205213
}
206214
}
207215

0 commit comments

Comments
 (0)