aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Chow <github@achow101.com>2023-09-27 16:35:30 -0400
committerAndrew Chow <github@achow101.com>2023-09-27 16:46:27 -0400
commit19a7e608f97838a58c2bbc058c6aea1d5ffe675f (patch)
tree8105b31c000814489891f0dd2fffea86f52092e5 /test
parentc9f288244b8d183e09a917025922b99e3368ef78 (diff)
parentb3db8c9d5ccfe5c31341169fa7ac044427122921 (diff)
downloadbitcoin-19a7e608f97838a58c2bbc058c6aea1d5ffe675f.tar.xz
Merge bitcoin/bitcoin#28505: rpc: bumpfee, improve doc for 'reduce_output' arg
b3db8c9d5ccfe5c31341169fa7ac044427122921 rpc: bumpfee, improve doc for 'reduce_output' arg (furszy) Pull request description: Fixes #28180. Resulted from discussions with S3RK, achow101, and Murch. The current argument name and description are dangerous as it don't describe the case where the user selects the recipient output as the change address. This one could end up been increased by the inputs minus outputs remainder. Which, when `bumpfee` adds new inputs to the transaction, leads the process to send more coins to the recipient. Which is not what the user would expect from a 'reduce_output' param naming. ACKs for top commit: S3RK: ACK b3db8c9d5ccfe5c31341169fa7ac044427122921 achow101: ACK b3db8c9d5ccfe5c31341169fa7ac044427122921 murchandamus: ACK b3db8c9d5ccfe5c31341169fa7ac044427122921 Tree-SHA512: 91f607e2f5849041d7c099afdddae11af8bed5b1ac90c9d22921267f272e21b44e107d6968e037f05f958a61fe29e94e5fb44b224fb3606f197f83ec4ba3b1e7
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/wallet_bumpfee.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/functional/wallet_bumpfee.py b/test/functional/wallet_bumpfee.py
index c66f279e88..fea933a93b 100755
--- a/test/functional/wallet_bumpfee.py
+++ b/test/functional/wallet_bumpfee.py
@@ -178,12 +178,12 @@ class BumpFeeTest(BitcoinTestFramework):
assert_raises_rpc_error(-8, "Invalid parameter, duplicate key: data",
rbf_node.bumpfee, rbfid, {"outputs": [{"data": "deadbeef"}, {"data": "deadbeef"}]})
- self.log.info("Test reduce_output option")
- assert_raises_rpc_error(-1, "JSON integer out of range", rbf_node.bumpfee, rbfid, {"reduce_output": -1})
- assert_raises_rpc_error(-8, "Change position is out of range", rbf_node.bumpfee, rbfid, {"reduce_output": 2})
+ self.log.info("Test original_change_index option")
+ assert_raises_rpc_error(-1, "JSON integer out of range", rbf_node.bumpfee, rbfid, {"original_change_index": -1})
+ assert_raises_rpc_error(-8, "Change position is out of range", rbf_node.bumpfee, rbfid, {"original_change_index": 2})
- self.log.info("Test outputs and reduce_output cannot both be provided")
- assert_raises_rpc_error(-8, "Cannot specify both new outputs to use and an output index to reduce", rbf_node.bumpfee, rbfid, {"reduce_output": 2, "outputs": [{dest_address: 0.1}]})
+ self.log.info("Test outputs and original_change_index cannot both be provided")
+ assert_raises_rpc_error(-8, "The options 'outputs' and 'original_change_index' are incompatible. You can only either specify a new set of outputs, or designate a change output to be recycled.", rbf_node.bumpfee, rbfid, {"original_change_index": 2, "outputs": [{dest_address: 0.1}]})
self.clear_mempool()
@@ -237,7 +237,7 @@ class BumpFeeTest(BitcoinTestFramework):
node.unloadwallet("back_to_yourself")
def test_provided_change_pos(self, rbf_node):
- self.log.info("Test the reduce_output option")
+ self.log.info("Test the original_change_index option")
change_addr = rbf_node.getnewaddress()
dest_addr = rbf_node.getnewaddress()
@@ -254,7 +254,7 @@ class BumpFeeTest(BitcoinTestFramework):
change_pos = find_vout_for_address(rbf_node, txid, change_addr)
change_value = tx["decoded"]["vout"][change_pos]["value"]
- bumped = rbf_node.bumpfee(txid, {"reduce_output": change_pos})
+ bumped = rbf_node.bumpfee(txid, {"original_change_index": change_pos})
new_txid = bumped["txid"]
new_tx = rbf_node.gettransaction(txid=new_txid, verbose=True)
@@ -282,18 +282,18 @@ class BumpFeeTest(BitcoinTestFramework):
tx = wallet.sendall(recipients=[wallet.getnewaddress()], fee_rate=2, options={"inputs": [utxos[0]]})
- # Reduce the only output with a crazy high feerate, should fail as the output would be dust
- assert_raises_rpc_error(-4, "The transaction amount is too small to pay the fee", wallet.bumpfee, txid=tx["txid"], options={"fee_rate": 1100, "reduce_output": 0})
+ # Set the only output with a crazy high feerate as change, should fail as the output would be dust
+ assert_raises_rpc_error(-4, "The transaction amount is too small to pay the fee", wallet.bumpfee, txid=tx["txid"], options={"fee_rate": 1100, "original_change_index": 0})
- # Reduce the only output successfully
- bumped = wallet.bumpfee(txid=tx["txid"], options={"fee_rate": 10, "reduce_output": 0})
+ # Specify single output as change successfully
+ bumped = wallet.bumpfee(txid=tx["txid"], options={"fee_rate": 10, "original_change_index": 0})
bumped_tx = wallet.gettransaction(txid=bumped["txid"], verbose=True)
assert_equal(len(bumped_tx["decoded"]["vout"]), 1)
assert_equal(len(bumped_tx["decoded"]["vin"]), 1)
assert_equal(bumped_tx["decoded"]["vout"][0]["value"] + bumped["fee"], amount)
assert_fee_amount(bumped["fee"], bumped_tx["decoded"]["vsize"], Decimal(10) / Decimal(1e8) * 1000)
- # Bumping without reducing adds a new input and output
+ # Bumping without specifying change adds a new input and output
bumped = wallet.bumpfee(txid=bumped["txid"], options={"fee_rate": 20})
bumped_tx = wallet.gettransaction(txid=bumped["txid"], verbose=True)
assert_equal(len(bumped_tx["decoded"]["vout"]), 2)