You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Co-authored-by: Murch <[email protected]>
//Cannot both specify new outputs and an output to reduce
168
-
if (!outputs.empty() && reduce_output.has_value()) {
169
-
errors.push_back(Untranslated("Cannot specify both new outputs to use and an output index to reduce"));
167
+
//For now, cannot specify both new outputs to use and an output index to send change
168
+
if (!outputs.empty() && original_change_index.has_value()) {
169
+
errors.push_back(Untranslated("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."));
{"outputs", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "The outputs specified as key-value pairs.\n"
1017
1017
"Each key may only appear once, i.e. there can only be one 'data' output, and no address may be duplicated.\n"
1018
1018
"At least one output of either type must be specified.\n"
1019
-
"Cannot be provided if 'reduce_output' is specified.",
1019
+
"Cannot be provided if 'original_change_index' is specified.",
1020
1020
OutputsDoc(),
1021
1021
RPCArgOptions{.skip_type_check = true}},
1022
-
{"reduce_output", RPCArg::Type::NUM, RPCArg::DefaultHint{"not set, detect change automatically"}, "The 0-based index of the output from which the additional fees will be deducted. In general, this should be the position of change output. Cannot be provided if 'outputs' is specified."},
1022
+
{"original_change_index", RPCArg::Type::NUM, RPCArg::DefaultHint{"not set, detect change automatically"}, "The 0-based index of the change output on the original transaction. "
1023
+
"The indicated output will be recycled into the new change output on the bumped transaction. "
1024
+
"The remainder after paying the recipients and fees will be sent to the output script of the "
1025
+
"original change output. The change output’s amount can increase if bumping the transaction "
1026
+
"adds new inputs, otherwise it will decrease. Cannot be used in combination with the 'outputs' option."},
assert_raises_rpc_error(-1, "JSON integer out of range", rbf_node.bumpfee, rbfid, {"original_change_index": -1})
183
+
assert_raises_rpc_error(-8, "Change position is out of range", rbf_node.bumpfee, rbfid, {"original_change_index": 2})
184
184
185
-
self.log.info("Test outputs and reduce_output cannot both be provided")
186
-
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}]})
185
+
self.log.info("Test outputs and original_change_index cannot both be provided")
186
+
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}]})
# Reduce the only output with a crazy high feerate, should fail as the output would be dust
286
-
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})
285
+
# Set the only output with a crazy high feerate as change, should fail as the output would be dust
286
+
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})
0 commit comments