Skip to content

Commit d73245a

Browse files
committed
Merge bitcoin/bitcoin#29120: test: Add test case for spending bare multisig
e504b1f test: Add test case for spending bare multisig (Brandon Odiwuor) Pull request description: Fixes bitcoin/bitcoin#29113 ACKs for top commit: ajtowns: ACK e504b1f ; LGTM and just checking the 1-of-3 case seems fine maflcko: utACK e504b1f achow101: ACK e504b1f willcl-ark: reACK e504b1f Tree-SHA512: 641a12599efa34e1a3eb65b125318df326628fef3e6886410ea9e63a044664fad7bcad46d1d6f41ddc59630746b9963cedb569c2682b5940b32b9225883da8f2
2 parents 842f7fd + e504b1f commit d73245a

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ void SetupServerArgs(ArgsManager& argsman)
634634
MAX_OP_RETURN_RELAY),
635635
ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
636636
argsman.AddArg("-mempoolfullrbf", strprintf("Accept transaction replace-by-fee without requiring replaceability signaling (default: %u)", DEFAULT_MEMPOOL_FULL_RBF), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);
637-
argsman.AddArg("-permitbaremultisig", strprintf("Relay non-P2SH multisig (default: %u)", DEFAULT_PERMIT_BAREMULTISIG), ArgsManager::ALLOW_ANY,
637+
argsman.AddArg("-permitbaremultisig", strprintf("Relay transactions creating non-P2SH multisig outputs (default: %u)", DEFAULT_PERMIT_BAREMULTISIG), ArgsManager::ALLOW_ANY,
638638
OptionsCategory::NODE_RELAY);
639639
argsman.AddArg("-minrelaytxfee=<amt>", strprintf("Fees (in %s/kvB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)",
640640
CURRENCY_UNIT, FormatMoney(DEFAULT_MIN_RELAY_TX_FEE)), ArgsManager::ALLOW_ANY, OptionsCategory::NODE_RELAY);

test/functional/mempool_accept.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
OP_HASH160,
2929
OP_RETURN,
3030
OP_TRUE,
31+
SIGHASH_ALL,
32+
sign_input_legacy,
3133
)
3234
from test_framework.script_util import (
3335
DUMMY_MIN_OP_RETURN_SCRIPT,
@@ -386,5 +388,24 @@ def run_test(self):
386388
maxfeerate=0,
387389
)
388390

391+
self.log.info('Spending a confirmed bare multisig is okay')
392+
address = self.wallet.get_address()
393+
tx = tx_from_hex(raw_tx_reference)
394+
privkey, pubkey = generate_keypair()
395+
tx.vout[0].scriptPubKey = keys_to_multisig_script([pubkey] * 3, k=1) # Some bare multisig script (1-of-3)
396+
tx.rehash()
397+
self.generateblock(node, address, [tx.serialize().hex()])
398+
tx_spend = CTransaction()
399+
tx_spend.vin.append(CTxIn(COutPoint(tx.sha256, 0), b""))
400+
tx_spend.vout.append(CTxOut(tx.vout[0].nValue - int(fee*COIN), script_to_p2wsh_script(CScript([OP_TRUE]))))
401+
tx_spend.rehash()
402+
sign_input_legacy(tx_spend, 0, tx.vout[0].scriptPubKey, privkey, sighash_type=SIGHASH_ALL)
403+
tx_spend.vin[0].scriptSig = bytes(CScript([OP_0])) + tx_spend.vin[0].scriptSig
404+
self.check_mempool_result(
405+
result_expected=[{'txid': tx_spend.rehash(), 'allowed': True, 'vsize': tx_spend.get_vsize(), 'fees': { 'base': Decimal('0.00000700')}}],
406+
rawtxs=[tx_spend.serialize().hex()],
407+
maxfeerate=0,
408+
)
409+
389410
if __name__ == '__main__':
390411
MempoolAcceptanceTest().main()

0 commit comments

Comments
 (0)