Skip to content

Commit 2c79abc

Browse files
committed
Merge bitcoin/bitcoin#27969: bumpfee: ignore WALLET_INCREMENTAL_RELAY_FEE when user specifies fee_rate
f58beab test: bumpfee with user specified fee_rate ignores walletIncrementalRelayFee (ismaelsadeeq) 436e88f bumpfee: ignore WALLET_INCREMENTAL_RELAY_FEE when user specifies fee rate (ismaelsadeeq) Pull request description: Fixes #26973 When using the `bumpfee` RPC and manually specifying `fee_rate`, there should be no requirement that the new fee must be at least the sum of the original fee and `incrementalFee` (maximum of `relayIncrementalFee` and `WALLET_INCREMENTAL_RELAY_FEE`). This restriction should only apply when user did not specify `fee_rate`. > because the GUI doesn't let the user specify the new fee rate yet (#647), it would be very annoying to have to bump 20 times to increment by 20 sat/vbyte. The restriction should instead be the new fee must be at least the sum of the original fee and `incrementalFee` (`relayIncrementalFee`) ACKs for top commit: achow101: ACK f58beab murchandamus: ACK f58beab Tree-SHA512: 193259f87173b7d5a8e68e0e29f2ca7e75c550e3cf0dee3d6d822b5b1e07c2e6dec0bfc8fb435855736ebced97a10dbdbfef72e8c5abde06fdefcba122f2e7f1
2 parents 538497b + f58beab commit 2c79abc

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

src/wallet/feebumper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static feebumper::Result CheckFeeRate(const CWallet& wallet, const CMutableTrans
9393
}
9494
CAmount new_total_fee = newFeerate.GetFee(maxTxSize) + combined_bump_fee.value();
9595

96-
CFeeRate incrementalRelayFee = std::max(wallet.chain().relayIncrementalFee(), CFeeRate(WALLET_INCREMENTAL_RELAY_FEE));
96+
CFeeRate incrementalRelayFee = wallet.chain().relayIncrementalFee();
9797

9898
// Min total fee is old fee + relay fee
9999
CAmount minTotalFee = old_fee + incrementalRelayFee.GetFee(maxTxSize);

test/functional/wallet_bumpfee.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ def run_test(self):
117117

118118
# Context independent tests
119119
test_feerate_checks_replaced_outputs(self, rbf_node, peer_node)
120+
test_bumpfee_with_feerate_ignores_walletincrementalrelayfee(self, rbf_node, peer_node)
120121

121122
def test_invalid_parameters(self, rbf_node, peer_node, dest_address):
122123
self.log.info('Test invalid parameters')
@@ -816,7 +817,7 @@ def test_feerate_checks_replaced_outputs(self, rbf_node, peer_node):
816817
# Since the bumped tx will replace all of the outputs with a single output, we can estimate that its size will 31 * (len(outputs) - 1) bytes smaller
817818
tx_size = tx_details["decoded"]["vsize"]
818819
est_bumped_size = tx_size - (len(tx_details["decoded"]["vout"]) - 1) * 31
819-
inc_fee_rate = max(rbf_node.getmempoolinfo()["incrementalrelayfee"], Decimal(0.00005000)) # Wallet has a fixed incremental relay fee of 5 sat/vb
820+
inc_fee_rate = rbf_node.getmempoolinfo()["incrementalrelayfee"]
820821
# RPC gives us fee as negative
821822
min_fee = (-tx_details["fee"] + get_fee(est_bumped_size, inc_fee_rate)) * Decimal(1e8)
822823
min_fee_rate = (min_fee / est_bumped_size).quantize(Decimal("1.000"))
@@ -830,5 +831,27 @@ def test_feerate_checks_replaced_outputs(self, rbf_node, peer_node):
830831
self.clear_mempool()
831832

832833

834+
def test_bumpfee_with_feerate_ignores_walletincrementalrelayfee(self, rbf_node, peer_node):
835+
self.log.info('Test that bumpfee with fee_rate ignores walletincrementalrelayfee')
836+
# Make sure there is enough balance
837+
peer_node.sendtoaddress(rbf_node.getnewaddress(), 2)
838+
self.generate(peer_node, 1)
839+
840+
dest_address = peer_node.getnewaddress(address_type="bech32")
841+
tx = rbf_node.send(outputs=[{dest_address: 1}], fee_rate=2)
842+
843+
# Ensure you can not fee bump with a fee_rate below or equal to the original fee_rate
844+
assert_raises_rpc_error(-8, "Insufficient total fee", rbf_node.bumpfee, tx["txid"], {"fee_rate": 1})
845+
assert_raises_rpc_error(-8, "Insufficient total fee", rbf_node.bumpfee, tx["txid"], {"fee_rate": 2})
846+
847+
# Ensure you can not fee bump if the fee_rate is more than original fee_rate but the total fee from new fee_rate is
848+
# less than (original fee + incrementalrelayfee)
849+
assert_raises_rpc_error(-8, "Insufficient total fee", rbf_node.bumpfee, tx["txid"], {"fee_rate": 2.8})
850+
851+
# You can fee bump as long as the new fee set from fee_rate is atleast (original fee + incrementalrelayfee)
852+
rbf_node.bumpfee(tx["txid"], {"fee_rate": 3})
853+
self.clear_mempool()
854+
855+
833856
if __name__ == "__main__":
834857
BumpFeeTest().main()

0 commit comments

Comments
 (0)