@@ -71,28 +71,29 @@ def run_test(self):
71
71
test_simple_bumpfee_succeeds (self , "default" , rbf_node , peer_node , dest_address )
72
72
test_simple_bumpfee_succeeds (self , "fee_rate" , rbf_node , peer_node , dest_address )
73
73
test_feerate_args (self , rbf_node , peer_node , dest_address )
74
- test_segwit_bumpfee_succeeds (rbf_node , dest_address )
75
- test_nonrbf_bumpfee_fails (peer_node , dest_address )
76
- test_notmine_bumpfee_fails (rbf_node , peer_node , dest_address )
77
- test_bumpfee_with_descendant_fails (rbf_node , rbf_node_address , dest_address )
78
- test_small_output_fails (rbf_node , dest_address )
79
- test_dust_to_fee (rbf_node , dest_address )
80
- test_settxfee (rbf_node , dest_address )
74
+ test_segwit_bumpfee_succeeds (self , rbf_node , dest_address )
75
+ test_nonrbf_bumpfee_fails (self , peer_node , dest_address )
76
+ test_notmine_bumpfee_fails (self , rbf_node , peer_node , dest_address )
77
+ test_bumpfee_with_descendant_fails (self , rbf_node , rbf_node_address , dest_address )
78
+ test_small_output_fails (self , rbf_node , dest_address )
79
+ test_dust_to_fee (self , rbf_node , dest_address )
80
+ test_settxfee (self , rbf_node , dest_address )
81
81
test_watchonly_psbt (self , peer_node , rbf_node , dest_address )
82
- test_rebumping (rbf_node , dest_address )
83
- test_rebumping_not_replaceable (rbf_node , dest_address )
84
- test_unconfirmed_not_spendable (rbf_node , rbf_node_address )
85
- test_bumpfee_metadata (rbf_node , dest_address )
86
- test_locked_wallet_fails (rbf_node , dest_address )
87
- test_change_script_match (rbf_node , dest_address )
82
+ test_rebumping (self , rbf_node , dest_address )
83
+ test_rebumping_not_replaceable (self , rbf_node , dest_address )
84
+ test_unconfirmed_not_spendable (self , rbf_node , rbf_node_address )
85
+ test_bumpfee_metadata (self , rbf_node , dest_address )
86
+ test_locked_wallet_fails (self , rbf_node , dest_address )
87
+ test_change_script_match (self , rbf_node , dest_address )
88
88
test_maxtxfee_fails (self , rbf_node , dest_address )
89
89
# These tests wipe out a number of utxos that are expected in other tests
90
- test_small_output_with_feerate_succeeds (rbf_node , dest_address )
91
- test_no_more_inputs_fails (rbf_node , dest_address )
90
+ test_small_output_with_feerate_succeeds (self , rbf_node , dest_address )
91
+ test_no_more_inputs_fails (self , rbf_node , dest_address )
92
92
self .log .info ("Success" )
93
93
94
94
95
95
def test_simple_bumpfee_succeeds (self , mode , rbf_node , peer_node , dest_address ):
96
+ self .log .info ('Test simple bumpfee' )
96
97
rbfid = spend_one_input (rbf_node , dest_address )
97
98
rbftx = rbf_node .gettransaction (rbfid )
98
99
self .sync_mempools ((rbf_node , peer_node ))
@@ -119,6 +120,7 @@ def test_simple_bumpfee_succeeds(self, mode, rbf_node, peer_node, dest_address):
119
120
assert_equal (bumpedwtx ["replaces_txid" ], rbfid )
120
121
121
122
def test_feerate_args (self , rbf_node , peer_node , dest_address ):
123
+ self .log .info ('Test feerate args' )
122
124
rbfid = spend_one_input (rbf_node , dest_address )
123
125
self .sync_mempools ((rbf_node , peer_node ))
124
126
assert rbfid in rbf_node .getrawmempool () and rbfid in peer_node .getrawmempool ()
@@ -135,7 +137,8 @@ def test_feerate_args(self, rbf_node, peer_node, dest_address):
135
137
assert_raises_rpc_error (- 4 , "is too high (cannot be higher than" , rbf_node .bumpfee , rbfid , {"fee_rate" :1 })
136
138
137
139
138
- def test_segwit_bumpfee_succeeds (rbf_node , dest_address ):
140
+ def test_segwit_bumpfee_succeeds (self , rbf_node , dest_address ):
141
+ self .log .info ('Test that segwit-sourcing bumpfee works' )
139
142
# Create a transaction with segwit output, then create an RBF transaction
140
143
# which spends it, and make sure bumpfee can be called on it.
141
144
@@ -165,14 +168,14 @@ def test_segwit_bumpfee_succeeds(rbf_node, dest_address):
165
168
assert rbfid not in rbf_node .getrawmempool ()
166
169
167
170
168
- def test_nonrbf_bumpfee_fails (peer_node , dest_address ):
169
- # cannot replace a non RBF transaction (from node which did not enable RBF )
171
+ def test_nonrbf_bumpfee_fails (self , peer_node , dest_address ):
172
+ self . log . info ( 'Test that we cannot replace a non RBF transaction' )
170
173
not_rbfid = peer_node .sendtoaddress (dest_address , Decimal ("0.00090000" ))
171
174
assert_raises_rpc_error (- 4 , "not BIP 125 replaceable" , peer_node .bumpfee , not_rbfid )
172
175
173
176
174
- def test_notmine_bumpfee_fails (rbf_node , peer_node , dest_address ):
175
- # cannot bump fee unless the tx has only inputs that we own.
177
+ def test_notmine_bumpfee_fails (self , rbf_node , peer_node , dest_address ):
178
+ self . log . info ( 'Test that it cannot bump fee if non-owned inputs are included' )
176
179
# here, the rbftx has a peer_node coin and then adds a rbf_node input
177
180
# Note that this test depends upon the RPC code checking input ownership prior to change outputs
178
181
# (since it can't use fundrawtransaction, it lacks a proper change output)
@@ -192,32 +195,34 @@ def test_notmine_bumpfee_fails(rbf_node, peer_node, dest_address):
192
195
rbf_node .bumpfee , rbfid )
193
196
194
197
195
- def test_bumpfee_with_descendant_fails (rbf_node , rbf_node_address , dest_address ):
196
- # cannot bump fee if the transaction has a descendant
198
+ def test_bumpfee_with_descendant_fails (self , rbf_node , rbf_node_address , dest_address ):
199
+ self . log . info ( 'Test that fee cannot be bumped when it has descendant' )
197
200
# parent is send-to-self, so we don't have to check which output is change when creating the child tx
198
201
parent_id = spend_one_input (rbf_node , rbf_node_address )
199
202
tx = rbf_node .createrawtransaction ([{"txid" : parent_id , "vout" : 0 }], {dest_address : 0.00020000 })
200
203
tx = rbf_node .signrawtransactionwithwallet (tx )
201
204
rbf_node .sendrawtransaction (tx ["hex" ])
202
205
assert_raises_rpc_error (- 8 , "Transaction has descendants in the wallet" , rbf_node .bumpfee , parent_id )
203
206
204
- def test_small_output_fails (rbf_node , dest_address ):
207
+ def test_small_output_fails (self , rbf_node , dest_address ):
208
+ self .log .info ('Test totalFee bump with small output fails' )
205
209
# cannot bump fee with a too-small output
206
210
rbfid = spend_one_input (rbf_node , dest_address )
207
211
rbf_node .bumpfee (rbfid , {"totalFee" : 50000 })
208
212
209
213
rbfid = spend_one_input (rbf_node , dest_address )
210
214
assert_raises_rpc_error (- 4 , "Change output is too small" , rbf_node .bumpfee , rbfid , {"totalFee" : 50001 })
211
215
212
- def test_small_output_with_feerate_succeeds (rbf_node , dest_address ):
216
+ def test_small_output_with_feerate_succeeds (self , rbf_node , dest_address ):
217
+ self .log .info ('Testing small output with feerate bump succeeds' )
213
218
214
219
# Make sure additional inputs exist
215
220
rbf_node .generatetoaddress (101 , rbf_node .getnewaddress ())
216
221
rbfid = spend_one_input (rbf_node , dest_address )
217
222
input_list = rbf_node .getrawtransaction (rbfid , 1 )["vin" ]
218
223
assert_equal (len (input_list ), 1 )
219
224
original_txin = input_list [0 ]
220
- # Keep bumping until we out-spend change output
225
+ self . log . info ( ' Keep bumping until transaction fee out-spends change output amount' )
221
226
tx_fee = 0
222
227
while tx_fee < Decimal ("0.0005" ):
223
228
input_list = rbf_node .getrawtransaction (rbfid , 1 )["vin" ]
@@ -244,8 +249,8 @@ def test_small_output_with_feerate_succeeds(rbf_node, dest_address):
244
249
rbf_node .generatetoaddress (1 , rbf_node .getnewaddress ())
245
250
assert_equal (rbf_node .gettransaction (rbfid )["confirmations" ], 1 )
246
251
247
- def test_dust_to_fee (rbf_node , dest_address ):
248
- # check that if output is reduced to dust, it will be converted to fee
252
+ def test_dust_to_fee (self , rbf_node , dest_address ):
253
+ self . log . info ( 'Test that bumped output that is dust is dropped to fee' )
249
254
# the bumped tx sets fee=49,900, but it converts to 50,000
250
255
rbfid = spend_one_input (rbf_node , dest_address )
251
256
fulltx = rbf_node .getrawtransaction (rbfid , 1 )
@@ -257,7 +262,8 @@ def test_dust_to_fee(rbf_node, dest_address):
257
262
assert_equal (len (full_bumped_tx ["vout" ]), 1 ) # change output is eliminated
258
263
259
264
260
- def test_settxfee (rbf_node , dest_address ):
265
+ def test_settxfee (self , rbf_node , dest_address ):
266
+ self .log .info ('Test settxfee' )
261
267
assert_raises_rpc_error (- 8 , "txfee cannot be less than min relay tx fee" , rbf_node .settxfee , Decimal ('0.000005' ))
262
268
assert_raises_rpc_error (- 8 , "txfee cannot be less than wallet min fee" , rbf_node .settxfee , Decimal ('0.000015' ))
263
269
# check that bumpfee reacts correctly to the use of settxfee (paytxfee)
@@ -272,17 +278,19 @@ def test_settxfee(rbf_node, dest_address):
272
278
rbf_node .settxfee (Decimal ("0.00000000" )) # unset paytxfee
273
279
274
280
275
- def test_maxtxfee_fails (test , rbf_node , dest_address ):
281
+ def test_maxtxfee_fails (self , rbf_node , dest_address ):
282
+ self .log .info ('Test that bumpfee fails when it hits -matxfee' )
276
283
# size of bumped transaction (p2wpkh, 1 input, 2 outputs): 141 vbytes
277
284
# expected bumping feerate of 20 sats/vbyte => 141*20 sats = 0.00002820 btc
278
- test .restart_node (1 , ['-maxtxfee=0.000025' ] + test .extra_args [1 ])
285
+ self .restart_node (1 , ['-maxtxfee=0.000025' ] + self .extra_args [1 ])
279
286
rbf_node .walletpassphrase (WALLET_PASSPHRASE , WALLET_PASSPHRASE_TIMEOUT )
280
287
rbfid = spend_one_input (rbf_node , dest_address )
281
288
assert_raises_rpc_error (- 4 , "Unable to create transaction: Fee exceeds maximum configured by -maxtxfee" , rbf_node .bumpfee , rbfid )
282
- test .restart_node (1 , test .extra_args [1 ])
289
+ self .restart_node (1 , self .extra_args [1 ])
283
290
rbf_node .walletpassphrase (WALLET_PASSPHRASE , WALLET_PASSPHRASE_TIMEOUT )
284
291
285
- def test_watchonly_psbt (test , peer_node , rbf_node , dest_address ):
292
+ def test_watchonly_psbt (self , peer_node , rbf_node , dest_address ):
293
+ self .log .info ('Test that PSBT is returned for bumpfee in watchonly wallets' )
286
294
priv_rec_desc = "wpkh([00000001/84'/1'/0']tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0/*)#rweraev0"
287
295
pub_rec_desc = rbf_node .getdescriptorinfo (priv_rec_desc )["descriptor" ]
288
296
priv_change_desc = "wpkh([00000001/84'/1'/0']tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/*)#j6uzqvuh"
@@ -334,7 +342,7 @@ def test_watchonly_psbt(test, peer_node, rbf_node, dest_address):
334
342
funding_address2 = watcher .getnewaddress (address_type = 'bech32' )
335
343
peer_node .sendmany ("" , {funding_address1 : 0.001 , funding_address2 : 0.001 })
336
344
peer_node .generate (1 )
337
- test .sync_all ()
345
+ self .sync_all ()
338
346
339
347
# Create single-input PSBT for transaction to be bumped
340
348
psbt = watcher .walletcreatefundedpsbt ([], {dest_address :0.0005 }, 0 , {"feeRate" : 0.00001 }, True )['psbt' ]
@@ -363,24 +371,24 @@ def test_watchonly_psbt(test, peer_node, rbf_node, dest_address):
363
371
rbf_node .unloadwallet ("watcher" )
364
372
rbf_node .unloadwallet ("signer" )
365
373
366
- def test_rebumping (rbf_node , dest_address ):
367
- # check that re-bumping the original tx fails, but bumping the bumper succeeds
374
+ def test_rebumping (self , rbf_node , dest_address ):
375
+ self . log . info ( 'Test that re-bumping the original tx fails, but bumping successor works' )
368
376
rbfid = spend_one_input (rbf_node , dest_address )
369
377
bumped = rbf_node .bumpfee (rbfid , {"totalFee" : 2000 })
370
378
assert_raises_rpc_error (- 4 , "already bumped" , rbf_node .bumpfee , rbfid , {"totalFee" : 3000 })
371
379
rbf_node .bumpfee (bumped ["txid" ], {"totalFee" : 3000 })
372
380
373
381
374
- def test_rebumping_not_replaceable (rbf_node , dest_address ):
375
- # check that re-bumping a non-replaceable bump tx fails
382
+ def test_rebumping_not_replaceable (self , rbf_node , dest_address ):
383
+ self . log . info ( 'Test that re-bumping non-replaceable fails' )
376
384
rbfid = spend_one_input (rbf_node , dest_address )
377
385
bumped = rbf_node .bumpfee (rbfid , {"totalFee" : 10000 , "replaceable" : False })
378
386
assert_raises_rpc_error (- 4 , "Transaction is not BIP 125 replaceable" , rbf_node .bumpfee , bumped ["txid" ],
379
387
{"totalFee" : 20000 })
380
388
381
389
382
- def test_unconfirmed_not_spendable (rbf_node , rbf_node_address ):
383
- # check that unconfirmed outputs from bumped transactions are not spendable
390
+ def test_unconfirmed_not_spendable (self , rbf_node , rbf_node_address ):
391
+ self . log . info ( 'Test that unconfirmed outputs from bumped txns are not spendable' )
384
392
rbfid = spend_one_input (rbf_node , rbf_node_address )
385
393
rbftx = rbf_node .gettransaction (rbfid )["hex" ]
386
394
assert rbfid in rbf_node .getrawmempool ()
@@ -418,7 +426,8 @@ def test_unconfirmed_not_spendable(rbf_node, rbf_node_address):
418
426
if t ["txid" ] == rbfid and t ["address" ] == rbf_node_address and t ["spendable" ]), 1 )
419
427
420
428
421
- def test_bumpfee_metadata (rbf_node , dest_address ):
429
+ def test_bumpfee_metadata (self , rbf_node , dest_address ):
430
+ self .log .info ('Test that bumped txn metadata persists to new txn record' )
422
431
assert (rbf_node .getbalance () < 49 )
423
432
rbf_node .generatetoaddress (101 , rbf_node .getnewaddress ())
424
433
rbfid = rbf_node .sendtoaddress (dest_address , 49 , "comment value" , "to value" )
@@ -428,15 +437,17 @@ def test_bumpfee_metadata(rbf_node, dest_address):
428
437
assert_equal (bumped_wtx ["to" ], "to value" )
429
438
430
439
431
- def test_locked_wallet_fails (rbf_node , dest_address ):
440
+ def test_locked_wallet_fails (self , rbf_node , dest_address ):
441
+ self .log .info ('Test that locked wallet cannot bump txn' )
432
442
rbfid = spend_one_input (rbf_node , dest_address )
433
443
rbf_node .walletlock ()
434
444
assert_raises_rpc_error (- 13 , "Please enter the wallet passphrase with walletpassphrase first." ,
435
445
rbf_node .bumpfee , rbfid )
436
446
rbf_node .walletpassphrase (WALLET_PASSPHRASE , WALLET_PASSPHRASE_TIMEOUT )
437
447
438
- def test_change_script_match (rbf_node , dest_address ):
439
- """Test that the same change addresses is used for the replacement transaction when possible."""
448
+ def test_change_script_match (self , rbf_node , dest_address ):
449
+ self .log .info ('Test that the same change addresses is used for the replacement transaction when possible.' )
450
+
440
451
def get_change_address (tx ):
441
452
tx_details = rbf_node .getrawtransaction (tx , 1 )
442
453
txout_addresses = [txout ['scriptPubKey' ]['addresses' ][0 ] for txout in tx_details ["vout" ]]
@@ -480,7 +491,8 @@ def submit_block_with_tx(node, tx):
480
491
node .submitblock (block .serialize ().hex ())
481
492
return block
482
493
483
- def test_no_more_inputs_fails (rbf_node , dest_address ):
494
+ def test_no_more_inputs_fails (self , rbf_node , dest_address ):
495
+ self .log .info ('Test that bumpfee fails when there are no available confirmed outputs' )
484
496
# feerate rbf requires confirmed outputs when change output doesn't exist or is insufficient
485
497
rbf_node .generatetoaddress (1 , dest_address )
486
498
# spend all funds, no change output
0 commit comments