mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 03:47:29 -03:00
Merge bitcoin/bitcoin#29088: tests: Don't depend on value of DEFAULT_PERMIT_BAREMULTISIG
7b45744df3
tests: ensure functional tests set permitbaremultisig=1 when needed (Anthony Towns)7dfabdcf86
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 ACK7b45744df3
instagibbs: crACK7b45744df3
ajtowns: > crACK [7b45744
](7b45744df3
) achow101: ACK7b45744df3
glozow: ACK7b45744df3
, changed default locally and all tests passed Tree-SHA512: f89f9e2bb11f07662cfd57390196df9e531064e1bd662e1db7dcfc97694394ae5e8014e9d209b9405aa09195bf46fc331b7fba10378065cdb270cbd0669ae904
This commit is contained in:
commit
3695ecbf68
3 changed files with 13 additions and 4 deletions
|
@ -18,9 +18,15 @@
|
|||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
// Helpers:
|
||||
static bool IsStandardTx(const CTransaction& tx, bool permit_bare_multisig, std::string& reason)
|
||||
{
|
||||
return IsStandardTx(tx, std::nullopt, permit_bare_multisig, CFeeRate{DUST_RELAY_TX_FEE}, reason);
|
||||
}
|
||||
|
||||
static bool IsStandardTx(const CTransaction& tx, std::string& reason)
|
||||
{
|
||||
return IsStandardTx(tx, std::nullopt, DEFAULT_PERMIT_BAREMULTISIG, CFeeRate{DUST_RELAY_TX_FEE}, reason);
|
||||
return IsStandardTx(tx, std::nullopt, /*permit_bare_multisig=*/true, CFeeRate{DUST_RELAY_TX_FEE}, reason) &&
|
||||
IsStandardTx(tx, std::nullopt, /*permit_bare_multisig=*/false, CFeeRate{DUST_RELAY_TX_FEE}, reason);
|
||||
}
|
||||
|
||||
static std::vector<unsigned char> Serialize(const CScript& s)
|
||||
|
@ -201,7 +207,9 @@ BOOST_AUTO_TEST_CASE(set)
|
|||
{
|
||||
SignatureData empty;
|
||||
BOOST_CHECK_MESSAGE(SignSignature(keystore, CTransaction(txFrom), txTo[i], 0, SIGHASH_ALL, empty), strprintf("SignSignature %d", i));
|
||||
BOOST_CHECK_MESSAGE(IsStandardTx(CTransaction(txTo[i]), reason), strprintf("txTo[%d].IsStandard", i));
|
||||
BOOST_CHECK_MESSAGE(IsStandardTx(CTransaction(txTo[i]), /*permit_bare_multisig=*/true, reason), strprintf("txTo[%d].IsStandard", i));
|
||||
bool no_pbms_is_std = IsStandardTx(CTransaction(txTo[i]), /*permit_bare_multisig=*/false, reason);
|
||||
BOOST_CHECK_MESSAGE((i == 0 ? no_pbms_is_std : !no_pbms_is_std), strprintf("txTo[%d].IsStandard(permbaremulti=false)", i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ DUST_RELAY_TX_FEE = 3000 # default setting [sat/kvB]
|
|||
class DustRelayFeeTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 1
|
||||
self.extra_args = [['-permitbaremultisig']]
|
||||
|
||||
def test_dust_output(self, node: TestNode, dust_relay_fee: Decimal,
|
||||
output_script: CScript, type_desc: str) -> None:
|
||||
|
@ -101,7 +102,7 @@ class DustRelayFeeTest(BitcoinTestFramework):
|
|||
else:
|
||||
dust_parameter = f"-dustrelayfee={dustfee_btc_kvb:.8f}"
|
||||
self.log.info(f"Test dust limit setting {dust_parameter} ({dustfee_sat_kvb} sat/kvB)...")
|
||||
self.restart_node(0, extra_args=[dust_parameter])
|
||||
self.restart_node(0, extra_args=[dust_parameter, "-permitbaremultisig"])
|
||||
|
||||
for output_script, description in output_scripts:
|
||||
self.test_dust_output(self.nodes[0], dustfee_btc_kvb, output_script, description)
|
||||
|
|
|
@ -139,7 +139,7 @@ class BytesPerSigOpTest(BitcoinTestFramework):
|
|||
self.log.info("Test a overly-large sigops-vbyte hits package limits")
|
||||
# Make a 2-transaction package which fails vbyte checks even though
|
||||
# separately they would work.
|
||||
self.restart_node(0, extra_args=["-bytespersigop=5000"] + self.extra_args[0])
|
||||
self.restart_node(0, extra_args=["-bytespersigop=5000","-permitbaremultisig=1"] + self.extra_args[0])
|
||||
|
||||
def create_bare_multisig_tx(utxo_to_spend=None):
|
||||
_, pubkey = generate_keypair()
|
||||
|
|
Loading…
Reference in a new issue