@@ -32,8 +32,8 @@ def set_test_params(self):
3232 self .noban_tx_relay = True
3333 self .supports_cli = False
3434 self .extra_args = [
35- ["-walletrbf=1" ],
36- ["-walletrbf=1" ]
35+ ["-walletrbf=1" , "-datacarriersize=16" ],
36+ ["-walletrbf=1" , "-datacarriersize=16" ]
3737 ]
3838 getcontext ().prec = 8 # Satoshi precision for Decimal
3939
@@ -45,7 +45,7 @@ def test_send(self, from_wallet, to_wallet=None, amount=None, data=None,
4545 conf_target = None , estimate_mode = None , fee_rate = None , add_to_wallet = None , psbt = None ,
4646 inputs = None , add_inputs = None , include_unsafe = None , change_address = None , change_position = None , change_type = None ,
4747 locktime = None , lock_unspents = None , replaceable = None , subtract_fee_from_outputs = None ,
48- expect_error = None , solving_data = None , minconf = None ):
48+ expect_error = None , solving_data = None , minconf = None , nonmempool = False ):
4949 assert_not_equal ((amount is None ), (data is None ))
5050
5151 from_balance_before = from_wallet .getbalances ()["mine" ]["trusted" ]
@@ -171,16 +171,20 @@ def test_send(self, from_wallet, to_wallet=None, amount=None, data=None,
171171 tx = from_wallet .gettransaction (res ["txid" ])
172172 assert tx
173173 assert_equal (tx ["bip125-replaceable" ], "yes" if replaceable else "no" )
174- # Ensure transaction exists in the mempool:
175- tx = from_wallet .getrawtransaction (res ["txid" ], True )
176- assert tx
177- if amount :
178- if subtract_fee_from_outputs :
179- assert_equal (from_balance_before - from_balance , amount )
180- else :
181- assert_greater_than (from_balance_before - from_balance , amount )
174+ if nonmempool :
175+ assert_raises_rpc_error (- 5 , "No such mempool transaction" , from_wallet .getrawtransaction , res ["txid" ])
176+ assert from_wallet .getbalances ()["mine" ]["nonmempool" ] < 0
182177 else :
183- assert next ((out for out in tx ["vout" ] if out ["scriptPubKey" ]["asm" ] == "OP_RETURN 35" ), None )
178+ # Ensure transaction exists in the mempool:
179+ tx = from_wallet .getrawtransaction (res ["txid" ], True )
180+ assert tx
181+ if amount :
182+ if subtract_fee_from_outputs :
183+ assert_equal (from_balance_before - from_balance , amount )
184+ else :
185+ assert_greater_than (from_balance_before - from_balance , amount )
186+ else :
187+ assert next ((out for out in tx ["vout" ] if out ["scriptPubKey" ]["asm" ] == "OP_RETURN 35" ), None )
184188 else :
185189 assert_equal (from_balance_before , from_balance )
186190
@@ -280,6 +284,9 @@ def run_test(self):
280284 res = w2 .walletprocesspsbt (res ["psbt" ])
281285 assert res ["complete" ]
282286
287+ self .log .info ("Create mempool-invalid tx (due to large OP_RETURN)..." )
288+ self .test_send (from_wallet = w0 , data = b"The quick brown fox jumps over the lazy dog" .hex (), nonmempool = True )
289+
283290 self .log .info ("Test setting explicit fee rate" )
284291 res1 = self .test_send (from_wallet = w0 , to_wallet = w1 , amount = 1 , arg_fee_rate = "1" , add_to_wallet = False )
285292 res2 = self .test_send (from_wallet = w0 , to_wallet = w1 , amount = 1 , fee_rate = "1" , add_to_wallet = False )
0 commit comments