aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_bumpfee.py
diff options
context:
space:
mode:
authorAndrew Chow <github@achow101.com>2023-01-11 18:18:10 -0500
committerAndrew Chow <github@achow101.com>2023-01-11 18:24:53 -0500
commitfbe5e1220a35c35a668ec965c66508a7839aa7dd (patch)
tree36b6da2dffd1a7dd276fad60712a48c27ade6632 /test/functional/wallet_bumpfee.py
parent2f6a8e5e02465e9de5c9f6202d5e3f8aa19bf70b (diff)
parentf9ce0eadf4eb58d1e2207c27fabe69a5642482e7 (diff)
downloadbitcoin-fbe5e1220a35c35a668ec965c66508a7839aa7dd.tar.xz
Merge bitcoin/bitcoin#26675: wallet: For feebump, ignore abandoned descendant spends
f9ce0eadf4eb58d1e2207c27fabe69a5642482e7 For feebump, ignore abandoned descendant spends (John Moffett) Pull request description: Closes #26667 To be eligible for fee-bumping, a transaction must not have any of its outputs (eg - change) spent in other unconfirmed transactions in the wallet. This behavior is currently [enforced](https://github.com/bitcoin/bitcoin/blob/9e229a542ff2107be43eff2e4b992841367f0366/src/wallet/feebumper.cpp#L25-L28) and [tested](https://github.com/bitcoin/bitcoin/blob/9e229a542ff2107be43eff2e4b992841367f0366/test/functional/wallet_bumpfee.py#L270-L286). However, this check shouldn't apply to spends in abandoned descendant transactions, as explained by #26667. `CWallet::IsSpent` already carves out an exception for abandoned transactions, so we can just use that. I've also added a new test to cover this case. ACKs for top commit: Sjors: re-utACK f9ce0eadf4eb58d1e2207c27fabe69a5642482e7 achow101: ACK f9ce0eadf4eb58d1e2207c27fabe69a5642482e7 furszy: ACK f9ce0ead Tree-SHA512: 19d957d1cf6747668bb114e27a305027bfca5a9bed2b1d9cc9e1b0bd4666486c7c4b60b045a7fe677eb9734d746f5de76390781fb1e9e0bceb4a46d20acd1749
Diffstat (limited to 'test/functional/wallet_bumpfee.py')
-rwxr-xr-xtest/functional/wallet_bumpfee.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/functional/wallet_bumpfee.py b/test/functional/wallet_bumpfee.py
index 1cb3f434e8..a2ae997ecb 100755
--- a/test/functional/wallet_bumpfee.py
+++ b/test/functional/wallet_bumpfee.py
@@ -88,6 +88,7 @@ class BumpFeeTest(BitcoinTestFramework):
test_nonrbf_bumpfee_fails(self, peer_node, dest_address)
test_notmine_bumpfee(self, rbf_node, peer_node, dest_address)
test_bumpfee_with_descendant_fails(self, rbf_node, rbf_node_address, dest_address)
+ test_bumpfee_with_abandoned_descendant_succeeds(self, rbf_node, rbf_node_address, dest_address)
test_dust_to_fee(self, rbf_node, dest_address)
test_watchonly_psbt(self, peer_node, rbf_node, dest_address)
test_rebumping(self, rbf_node, dest_address)
@@ -286,6 +287,35 @@ def test_bumpfee_with_descendant_fails(self, rbf_node, rbf_node_address, dest_ad
self.clear_mempool()
+def test_bumpfee_with_abandoned_descendant_succeeds(self, rbf_node, rbf_node_address, dest_address):
+ self.log.info('Test that fee can be bumped when it has abandoned descendant')
+ # parent is send-to-self, so we don't have to check which output is change when creating the child tx
+ parent_id = spend_one_input(rbf_node, rbf_node_address)
+ # Submit child transaction with low fee
+ child_id = rbf_node.send(outputs={dest_address: 0.00020000},
+ options={"inputs": [{"txid": parent_id, "vout": 0}], "fee_rate": 2})["txid"]
+ assert child_id in rbf_node.getrawmempool()
+
+ # Restart the node with higher min relay fee so the descendant tx is no longer in mempool so that we can abandon it
+ self.restart_node(1, ['-minrelaytxfee=0.00005'] + self.extra_args[1])
+ rbf_node.walletpassphrase(WALLET_PASSPHRASE, WALLET_PASSPHRASE_TIMEOUT)
+ self.connect_nodes(1, 0)
+ assert parent_id in rbf_node.getrawmempool()
+ assert child_id not in rbf_node.getrawmempool()
+ # Should still raise an error even if not in mempool
+ assert_raises_rpc_error(-8, "Transaction has descendants in the wallet", rbf_node.bumpfee, parent_id)
+ # Now abandon the child transaction and bump the original
+ rbf_node.abandontransaction(child_id)
+ bumped_result = rbf_node.bumpfee(parent_id, {"fee_rate": HIGH})
+ assert bumped_result['txid'] in rbf_node.getrawmempool()
+ assert parent_id not in rbf_node.getrawmempool()
+ # Cleanup
+ self.restart_node(1, self.extra_args[1])
+ rbf_node.walletpassphrase(WALLET_PASSPHRASE, WALLET_PASSPHRASE_TIMEOUT)
+ self.connect_nodes(1, 0)
+ self.clear_mempool()
+
+
def test_small_output_with_feerate_succeeds(self, rbf_node, dest_address):
self.log.info('Testing small output with feerate bump succeeds')