v31.1-roots.1 · Commit 2: [PATCH 02/17] feat(policy): preserve Roots parsing and local transaction checks
test/functional/mempool_sigoplimit.py
Before: test/functional/mempool_sigoplimit.py · After: test/functional/mempool_sigoplimit.py
File metadata
index 932e045a81621d89a148912ebba36cebe359e0d2..810ba432c5383fb2535f3ece738578552a4f118c 100755
Download original patch · Release notes
Diff rows 1–31 of 31. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
test/functional/mempool_sigoplimit.py
CHANGED
|
@@ -52,6 +52,7 @@ MAX_PUBKEYS_PER_MULTISIG = 20
|
|
| 52 |
class BytesPerSigOpTest(BitcoinTestFramework):
|
| 53 |
def set_test_params(self):
|
| 54 |
self.num_nodes = 1
|
|
|
|
| 55 |
|
| 56 |
def create_p2wsh_spending_tx(self, witness_script, output_script):
|
| 57 |
"""Create a 1-input-1-output P2WSH spending transaction with only the
|
|
@@ -145,7 +146,7 @@ class BytesPerSigOpTest(BitcoinTestFramework):
|
|
| 145 |
self.log.info("Test a overly-large sigops-vbyte hits package limits")
|
| 146 |
# Make a 2-transaction package which fails vbyte checks even though
|
| 147 |
# separately they would work.
|
| 148 |
-
self.restart_node(0, extra_args=["-bytespersigop=5000","-permitbaremultisig=1"])
|
| 149 |
|
| 150 |
def create_bare_multisig_tx(utxo_to_spend=None):
|
| 151 |
_, pubkey = generate_keypair()
|
|
@@ -208,7 +209,7 @@ class BytesPerSigOpTest(BitcoinTestFramework):
|
|
| 208 |
nonstd_tx = CTransaction()
|
| 209 |
nonstd_tx.vin = [CTxIn(op, CScript([b"", packed_redeem_script])) for op in outpoints]
|
| 210 |
nonstd_tx.vout = [CTxOut(0, CScript([OP_RETURN, b""]))]
|
| 211 |
-
assert_raises_rpc_error(-26, "bad-txns-nonstandard-inputs", self.nodes[0].sendrawtransaction, nonstd_tx.serialize().hex())
|
| 212 |
|
| 213 |
# Spending one less accounts for 2490 legacy sigops and is standard.
|
| 214 |
std_tx = deepcopy(nonstd_tx)
|
|
@@ -227,7 +228,7 @@ class BytesPerSigOpTest(BitcoinTestFramework):
|
|
| 227 |
else:
|
| 228 |
bytespersigop_parameter = f"-bytespersigop={bytes_per_sigop}"
|
| 229 |
self.log.info(f"Test sigops limit setting {bytespersigop_parameter}...")
|
| 230 |
-
self.restart_node(0, extra_args=[bytespersigop_parameter])
|
| 231 |
|
| 232 |
for num_sigops in (69, 101, 142, 183, 222):
|
| 233 |
self.test_sigops_limit(bytes_per_sigop, num_sigops)
|
|
|
|
| 52 |
class BytesPerSigOpTest(BitcoinTestFramework):
|
| 53 |
def set_test_params(self):
|
| 54 |
self.num_nodes = 1
|
| 55 |
+
self.extra_args = [['-datacarriersize=100000', '-maxscriptsize=100000', '-acceptnonstddatacarrier=1', '-permitbaredatacarrier=1']]
|
| 56 |
|
| 57 |
def create_p2wsh_spending_tx(self, witness_script, output_script):
|
| 58 |
"""Create a 1-input-1-output P2WSH spending transaction with only the
|
|
|
|
| 146 |
self.log.info("Test a overly-large sigops-vbyte hits package limits")
|
| 147 |
# Make a 2-transaction package which fails vbyte checks even though
|
| 148 |
# separately they would work.
|
| 149 |
+
self.restart_node(0, extra_args=self.extra_args[0] + ["-bytespersigop=5000", "-permitbaremultisig=1"])
|
| 150 |
|
| 151 |
def create_bare_multisig_tx(utxo_to_spend=None):
|
| 152 |
_, pubkey = generate_keypair()
|
|
|
|
| 209 |
nonstd_tx = CTransaction()
|
| 210 |
nonstd_tx.vin = [CTxIn(op, CScript([b"", packed_redeem_script])) for op in outpoints]
|
| 211 |
nonstd_tx.vout = [CTxOut(0, CScript([OP_RETURN, b""]))]
|
| 212 |
+
assert_raises_rpc_error(-26, "bad-txns-input-sigops-toomany-overall", self.nodes[0].sendrawtransaction, nonstd_tx.serialize().hex())
|
| 213 |
|
| 214 |
# Spending one less accounts for 2490 legacy sigops and is standard.
|
| 215 |
std_tx = deepcopy(nonstd_tx)
|
|
|
|
| 228 |
else:
|
| 229 |
bytespersigop_parameter = f"-bytespersigop={bytes_per_sigop}"
|
| 230 |
self.log.info(f"Test sigops limit setting {bytespersigop_parameter}...")
|
| 231 |
+
self.restart_node(0, extra_args=self.extra_args[0] + [bytespersigop_parameter])
|
| 232 |
|
| 233 |
for num_sigops in (69, 101, 142, 183, 222):
|
| 234 |
self.test_sigops_limit(bytes_per_sigop, num_sigops)
|