22
22
23
23
MAX_REPLACEMENT_CANDIDATES = 100
24
24
TRUC_MAX_VSIZE = 10000
25
+ TRUC_CHILD_MAX_VSIZE = 1000
25
26
26
27
def cleanup (extra_args = None ):
27
28
def decorator (func ):
@@ -72,10 +73,10 @@ def test_truc_acceptance(self):
72
73
self .check_mempool ([tx_v3_parent_normal ["txid" ]])
73
74
tx_v3_child_heavy = self .wallet .create_self_transfer (
74
75
utxo_to_spend = tx_v3_parent_normal ["new_utxo" ],
75
- target_vsize = 1001 ,
76
+ target_vsize = TRUC_CHILD_MAX_VSIZE + 1 ,
76
77
version = 3
77
78
)
78
- assert_greater_than_or_equal (tx_v3_child_heavy ["tx" ].get_vsize (), 1000 )
79
+ assert_greater_than_or_equal (tx_v3_child_heavy ["tx" ].get_vsize (), TRUC_CHILD_MAX_VSIZE )
79
80
expected_error_child_heavy = f"TRUC-violation, version=3 child tx { tx_v3_child_heavy ['txid' ]} (wtxid={ tx_v3_child_heavy ['wtxid' ]} ) is too big"
80
81
assert_raises_rpc_error (- 26 , expected_error_child_heavy , node .sendrawtransaction , tx_v3_child_heavy ["hex" ])
81
82
self .check_mempool ([tx_v3_parent_normal ["txid" ]])
@@ -87,10 +88,10 @@ def test_truc_acceptance(self):
87
88
from_node = node ,
88
89
fee_rate = DEFAULT_FEE ,
89
90
utxo_to_spend = tx_v3_parent_normal ["new_utxo" ],
90
- target_vsize = 997 ,
91
+ target_vsize = TRUC_CHILD_MAX_VSIZE - 3 ,
91
92
version = 3
92
93
)
93
- assert_greater_than_or_equal (1000 , tx_v3_child_almost_heavy ["tx" ].get_vsize ())
94
+ assert_greater_than_or_equal (TRUC_CHILD_MAX_VSIZE , tx_v3_child_almost_heavy ["tx" ].get_vsize ())
94
95
self .check_mempool ([tx_v3_parent_normal ["txid" ], tx_v3_child_almost_heavy ["txid" ]])
95
96
assert_equal (node .getmempoolentry (tx_v3_parent_normal ["txid" ])["descendantcount" ], 2 )
96
97
tx_v3_child_almost_heavy_rbf = self .wallet .send_self_transfer (
@@ -100,7 +101,8 @@ def test_truc_acceptance(self):
100
101
target_vsize = 875 ,
101
102
version = 3
102
103
)
103
- assert_greater_than_or_equal (tx_v3_child_almost_heavy ["tx" ].get_vsize () + tx_v3_child_almost_heavy_rbf ["tx" ].get_vsize (), 1000 )
104
+ assert_greater_than_or_equal (tx_v3_child_almost_heavy ["tx" ].get_vsize () + tx_v3_child_almost_heavy_rbf ["tx" ].get_vsize (),
105
+ TRUC_CHILD_MAX_VSIZE )
104
106
self .check_mempool ([tx_v3_parent_normal ["txid" ], tx_v3_child_almost_heavy_rbf ["txid" ]])
105
107
assert_equal (node .getmempoolentry (tx_v3_parent_normal ["txid" ])["descendantcount" ], 2 )
106
108
@@ -199,7 +201,7 @@ def test_truc_reorg(self):
199
201
tx_v2_from_v3 = self .wallet .send_self_transfer (from_node = node , utxo_to_spend = tx_v3_block ["new_utxo" ], version = 2 )
200
202
tx_v3_from_v2 = self .wallet .send_self_transfer (from_node = node , utxo_to_spend = tx_v2_block ["new_utxo" ], version = 3 )
201
203
tx_v3_child_large = self .wallet .send_self_transfer (from_node = node , utxo_to_spend = tx_v3_block2 ["new_utxo" ], target_vsize = 1250 , version = 3 )
202
- assert_greater_than (node .getmempoolentry (tx_v3_child_large ["txid" ])["vsize" ], 1000 )
204
+ assert_greater_than (node .getmempoolentry (tx_v3_child_large ["txid" ])["vsize" ], TRUC_CHILD_MAX_VSIZE )
203
205
self .check_mempool ([tx_v2_from_v3 ["txid" ], tx_v3_from_v2 ["txid" ], tx_v3_child_large ["txid" ]])
204
206
node .invalidateblock (block [0 ])
205
207
self .check_mempool ([tx_v3_block ["txid" ], tx_v2_block ["txid" ], tx_v3_block2 ["txid" ], tx_v2_from_v3 ["txid" ], tx_v3_from_v2 ["txid" ], tx_v3_child_large ["txid" ]])
@@ -231,7 +233,7 @@ def test_nondefault_package_limits(self):
231
233
232
234
# Parent and child are within v3 limits, but parent's 10kvB descendant limit is exceeded
233
235
assert_greater_than_or_equal (TRUC_MAX_VSIZE , tx_v3_parent_large1 ["tx" ].get_vsize ())
234
- assert_greater_than_or_equal (1000 , tx_v3_child_large1 ["tx" ].get_vsize ())
236
+ assert_greater_than_or_equal (TRUC_CHILD_MAX_VSIZE , tx_v3_child_large1 ["tx" ].get_vsize ())
235
237
assert_greater_than (tx_v3_parent_large1 ["tx" ].get_vsize () + tx_v3_child_large1 ["tx" ].get_vsize (), 10000 )
236
238
237
239
assert_raises_rpc_error (- 26 , f"too-long-mempool-chain, exceeds descendant size limit for tx { tx_v3_parent_large1 ['txid' ]} " , node .sendrawtransaction , tx_v3_child_large1 ["hex" ])
@@ -254,7 +256,7 @@ def test_nondefault_package_limits(self):
254
256
255
257
# Parent and child are within TRUC limits
256
258
assert_greater_than_or_equal (TRUC_MAX_VSIZE , tx_v3_parent_large2 ["tx" ].get_vsize ())
257
- assert_greater_than_or_equal (1000 , tx_v3_child_large2 ["tx" ].get_vsize ())
259
+ assert_greater_than_or_equal (TRUC_CHILD_MAX_VSIZE , tx_v3_child_large2 ["tx" ].get_vsize ())
258
260
assert_greater_than (tx_v3_parent_large2 ["tx" ].get_vsize () + tx_v3_child_large2 ["tx" ].get_vsize (), 10000 )
259
261
260
262
assert_raises_rpc_error (- 26 , f"too-long-mempool-chain, exceeds ancestor size limit" , node .sendrawtransaction , tx_v3_child_large2 ["hex" ])
@@ -281,7 +283,7 @@ def test_truc_ancestors_package(self):
281
283
)
282
284
tx_v3_child_heavy = self .wallet .create_self_transfer_multi (
283
285
utxos_to_spend = [tx_v3_parent_normal ["new_utxo" ]],
284
- target_vsize = 1001 ,
286
+ target_vsize = TRUC_CHILD_MAX_VSIZE + 1 ,
285
287
fee_per_output = 10000 ,
286
288
version = 3
287
289
)
0 commit comments