Skip to content

Commit 3695ecb

Browse files
committed
Merge bitcoin/bitcoin#29088: tests: Don't depend on value of DEFAULT_PERMIT_BAREMULTISIG
7b45744 tests: ensure functional tests set permitbaremultisig=1 when needed (Anthony Towns) 7dfabdc tests: test both settings for permitbaremultisig in p2sh tests (Anthony Towns) Pull request description: Update unit and functional tests so that they continue to work if the default for `-permitbaremultisig` is changed. ACKs for top commit: maflcko: lgtm ACK 7b45744 instagibbs: crACK bitcoin/bitcoin@7b45744 ajtowns: > crACK [7b45744](bitcoin/bitcoin@7b45744) achow101: ACK 7b45744 glozow: ACK 7b45744, changed default locally and all tests passed Tree-SHA512: f89f9e2bb11f07662cfd57390196df9e531064e1bd662e1db7dcfc97694394ae5e8014e9d209b9405aa09195bf46fc331b7fba10378065cdb270cbd0669ae904
2 parents 9776186 + 7b45744 commit 3695ecb

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
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

test/functional/mempool_dust.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
class DustRelayFeeTest(BitcoinTestFramework):
4141
def set_test_params(self):
4242
self.num_nodes = 1
43+
self.extra_args = [['-permitbaremultisig']]
4344

4445
def test_dust_output(self, node: TestNode, dust_relay_fee: Decimal,
4546
output_script: CScript, type_desc: str) -> None:
@@ -101,7 +102,7 @@ def run_test(self):
101102
else:
102103
dust_parameter = f"-dustrelayfee={dustfee_btc_kvb:.8f}"
103104
self.log.info(f"Test dust limit setting {dust_parameter} ({dustfee_sat_kvb} sat/kvB)...")
104-
self.restart_node(0, extra_args=[dust_parameter])
105+
self.restart_node(0, extra_args=[dust_parameter, "-permitbaremultisig"])
105106

106107
for output_script, description in output_scripts:
107108
self.test_dust_output(self.nodes[0], dustfee_btc_kvb, output_script, description)

test/functional/mempool_sigoplimit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def test_sigops_package(self):
139139
self.log.info("Test a overly-large sigops-vbyte hits package limits")
140140
# Make a 2-transaction package which fails vbyte checks even though
141141
# separately they would work.
142-
self.restart_node(0, extra_args=["-bytespersigop=5000"] + self.extra_args[0])
142+
self.restart_node(0, extra_args=["-bytespersigop=5000","-permitbaremultisig=1"] + self.extra_args[0])
143143

144144
def create_bare_multisig_tx(utxo_to_spend=None):
145145
_, pubkey = generate_keypair()

0 commit comments

Comments
 (0)