Skip to content

Commit 74eb194

Browse files
committed
test: check that bumping tx with already spent coin fails
1 parent 0b02ce9 commit 74eb194

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

test/functional/wallet_bumpfee.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def run_test(self):
9393
test_watchonly_psbt(self, peer_node, rbf_node, dest_address)
9494
test_rebumping(self, rbf_node, dest_address)
9595
test_rebumping_not_replaceable(self, rbf_node, dest_address)
96+
test_bumpfee_already_spent(self, rbf_node, dest_address)
9697
test_unconfirmed_not_spendable(self, rbf_node, rbf_node_address)
9798
test_bumpfee_metadata(self, rbf_node, dest_address)
9899
test_locked_wallet_fails(self, rbf_node, dest_address)
@@ -229,7 +230,7 @@ def test_segwit_bumpfee_succeeds(self, rbf_node, dest_address):
229230
def test_nonrbf_bumpfee_fails(self, peer_node, dest_address):
230231
self.log.info('Test that we cannot replace a non RBF transaction')
231232
not_rbfid = peer_node.sendtoaddress(dest_address, Decimal("0.00090000"))
232-
assert_raises_rpc_error(-4, "not BIP 125 replaceable", peer_node.bumpfee, not_rbfid)
233+
assert_raises_rpc_error(-4, "Transaction is not BIP 125 replaceable", peer_node.bumpfee, not_rbfid)
233234
self.clear_mempool()
234235

235236

@@ -499,7 +500,8 @@ def test_rebumping(self, rbf_node, dest_address):
499500
self.log.info('Test that re-bumping the original tx fails, but bumping successor works')
500501
rbfid = spend_one_input(rbf_node, dest_address)
501502
bumped = rbf_node.bumpfee(rbfid, {"fee_rate": ECONOMICAL})
502-
assert_raises_rpc_error(-4, "already bumped", rbf_node.bumpfee, rbfid, {"fee_rate": NORMAL})
503+
assert_raises_rpc_error(-4, f"Cannot bump transaction {rbfid} which was already bumped by transaction {bumped['txid']}",
504+
rbf_node.bumpfee, rbfid, {"fee_rate": NORMAL})
503505
rbf_node.bumpfee(bumped["txid"], {"fee_rate": NORMAL})
504506
self.clear_mempool()
505507

@@ -513,6 +515,15 @@ def test_rebumping_not_replaceable(self, rbf_node, dest_address):
513515
self.clear_mempool()
514516

515517

518+
def test_bumpfee_already_spent(self, rbf_node, dest_address):
519+
self.log.info('Test that bumping tx with already spent coin fails')
520+
txid = spend_one_input(rbf_node, dest_address)
521+
self.generate(rbf_node, 1) # spend coin simply by mining block with tx
522+
spent_input = rbf_node.gettransaction(txid=txid, verbose=True)['decoded']['vin'][0]
523+
assert_raises_rpc_error(-1, f"{spent_input['txid']}:{spent_input['vout']} is already spent",
524+
rbf_node.bumpfee, txid, {"fee_rate": NORMAL})
525+
526+
516527
def test_unconfirmed_not_spendable(self, rbf_node, rbf_node_address):
517528
self.log.info('Test that unconfirmed outputs from bumped txns are not spendable')
518529
rbfid = spend_one_input(rbf_node, rbf_node_address)

0 commit comments

Comments
 (0)