Skip to content

Commit ec9b964

Browse files
author
MarcoFalke
committed
Merge #17541: test: add functional test for non-standard bare multisig txs
1be0b1f test: add functional test for non-standard bare multisig txs (Sebastian Falbesoner) Pull request description: Approaches another missing functional test of issue #17394 (counterpart to unit test in PR #17502): A transaction is rejected by the mempool with reason `"bare-multisig"` if any of the outputs' scriptPubKey has bare multisig format (`M <PubKey1> <PubKey2> ... <PubKeyN> N OP_CHECKSIG`) and bitcoind is started with the argument `-permitbaremultisig=0`. ACKs for top commit: instagibbs: utACK bitcoin/bitcoin@1be0b1f kristapsk: ACK 1be0b1f Tree-SHA512: 2cade68c4454029b62278b38d0f137c2605a0e4450c435cdda2833667234edd4406f017ed12fa8df9730618654acbaeb68b16dcabb9f5aa84bad9f1c76c6d476
2 parents 218274d + 1be0b1f commit ec9b964

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

test/functional/mempool_accept.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import math
99

1010
from test_framework.test_framework import BitcoinTestFramework
11+
from test_framework.key import ECKey
1112
from test_framework.messages import (
1213
BIP125_SEQUENCE_NUMBER,
1314
COIN,
@@ -20,6 +21,9 @@
2021
hash160,
2122
CScript,
2223
OP_0,
24+
OP_2,
25+
OP_3,
26+
OP_CHECKMULTISIG,
2327
OP_EQUAL,
2428
OP_HASH160,
2529
OP_RETURN,
@@ -35,7 +39,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
3539
def set_test_params(self):
3640
self.num_nodes = 1
3741
self.extra_args = [[
38-
'-txindex',
42+
'-txindex','-permitbaremultisig=0',
3943
]] * self.num_nodes
4044
self.supports_cli = False
4145

@@ -262,6 +266,15 @@ def run_test(self):
262266
rawtxs=[tx.serialize().hex()],
263267
)
264268
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
269+
key = ECKey()
270+
key.generate()
271+
pubkey = key.get_pubkey().get_bytes()
272+
tx.vout[0].scriptPubKey = CScript([OP_2, pubkey, pubkey, pubkey, OP_3, OP_CHECKMULTISIG]) # Some bare multisig script (2-of-3)
273+
self.check_mempool_result(
274+
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'bare-multisig'}],
275+
rawtxs=[tx.serialize().hex()],
276+
)
277+
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
265278
tx.vin[0].scriptSig = CScript([OP_HASH160]) # Some not-pushonly scriptSig
266279
self.check_mempool_result(
267280
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'scriptsig-not-pushonly'}],

0 commit comments

Comments
 (0)