Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/functional/mempool_package_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def run_test(self):
self.test_anc_count_limits_2()
self.test_anc_count_limits_bushy()

# The node will accept our (nonstandard) extra large OP_RETURN outputs
self.restart_node(0, extra_args=["-acceptnonstdtxn=1"])
# The node will accept (nonstandard) extra large OP_RETURN outputs
self.restart_node(0, extra_args=["-datacarriersize=100000"])
self.test_anc_size_limits()
self.test_desc_size_limits()

Expand Down
22 changes: 15 additions & 7 deletions test/functional/test_framework/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
)
from test_framework.script import (
CScript,
SignatureHash,
OP_TRUE,
OP_NOP,
OP_RETURN,
OP_TRUE,
SignatureHash,
SIGHASH_ALL,
)
from test_framework.script_util import (
Expand Down Expand Up @@ -97,11 +98,18 @@ def _bulk_tx(self, tx, target_weight):
"""Pad a transaction with extra outputs until it reaches a target weight (or higher).
returns the tx
"""
assert_greater_than_or_equal(target_weight, tx.get_weight())
while tx.get_weight() < target_weight:
script_pubkey = ( b"6a4d0200" # OP_RETURN OP_PUSH2 512 bytes
+ b"01" * 512 )
tx.vout.append(CTxOut(0, script_pubkey))
tx.vout.append(CTxOut(nValue=0, scriptPubKey=CScript([OP_RETURN, b'a'])))
# In Dash, get_weight() returns vsize directly (no witness scaling factor like Bitcoin's 4)
# Bitcoin's formula: (target_weight - tx.get_weight() + 3) // 4
# - The +3 ensures rounding up when dividing by 4
# - After division, this adds 0-3 vbytes depending on remainder
# For Dash (no division by 4), we calculate bytes needed directly
dummy_vbytes = target_weight - tx.get_weight()
tx.vout[-1].scriptPubKey = CScript([OP_RETURN, b'a' * dummy_vbytes])
# Lower bound should always be off by at most 3
assert_greater_than_or_equal(tx.get_weight(), target_weight)
# Higher bound should always be off by at most 3 + 12 weight (for encoding the length)
assert_greater_than_or_equal(target_weight + 15, tx.get_weight())

def get_balance(self):
return sum(u['value'] for u in self._utxos)
Expand Down
Loading