aboutsummaryrefslogtreecommitdiff
path: root/test/functional/mempool_accept.py
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2019-11-20 21:40:53 +0100
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2019-11-20 21:40:53 +0100
commit1be0b1fb2adcf95d76f879195564c0bf84162e31 (patch)
tree5faa376bd6d36fd6a87b78adbaae166c4c9be5ea /test/functional/mempool_accept.py
parenta8d9f7dfa72395e95c9f197b47f2120e19f1b1d2 (diff)
downloadbitcoin-1be0b1fb2adcf95d76f879195564c0bf84162e31.tar.xz
test: add functional test for non-standard bare multisig txs
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 "-permitbaremultisig=0".
Diffstat (limited to 'test/functional/mempool_accept.py')
-rwxr-xr-xtest/functional/mempool_accept.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/functional/mempool_accept.py b/test/functional/mempool_accept.py
index 0eef1d3ddf..95d8053dc2 100755
--- a/test/functional/mempool_accept.py
+++ b/test/functional/mempool_accept.py
@@ -8,6 +8,7 @@ from io import BytesIO
import math
from test_framework.test_framework import BitcoinTestFramework
+from test_framework.key import ECKey
from test_framework.messages import (
BIP125_SEQUENCE_NUMBER,
COIN,
@@ -20,6 +21,9 @@ from test_framework.script import (
hash160,
CScript,
OP_0,
+ OP_2,
+ OP_3,
+ OP_CHECKMULTISIG,
OP_EQUAL,
OP_HASH160,
OP_RETURN,
@@ -35,7 +39,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
self.extra_args = [[
- '-txindex',
+ '-txindex','-permitbaremultisig=0',
]] * self.num_nodes
def skip_test_if_missing_module(self):
@@ -261,6 +265,15 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
rawtxs=[tx.serialize().hex()],
)
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
+ key = ECKey()
+ key.generate()
+ pubkey = key.get_pubkey().get_bytes()
+ tx.vout[0].scriptPubKey = CScript([OP_2, pubkey, pubkey, pubkey, OP_3, OP_CHECKMULTISIG]) # Some bare multisig script (2-of-3)
+ self.check_mempool_result(
+ result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'bare-multisig'}],
+ rawtxs=[tx.serialize().hex()],
+ )
+ tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
tx.vin[0].scriptSig = CScript([OP_HASH160]) # Some not-pushonly scriptSig
self.check_mempool_result(
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'scriptsig-not-pushonly'}],