[bitcoin/bitcoin] [wallet] couple of walletcreatefundedpsbt fixes (#13968)

achow101 commented on this pull request.

> @@ -4718,7 +4717,12 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
CAmount fee;
int change_position;
CMutableTransaction rawTx = ConstructTransaction(request.params[0], request.params[1], request.params[2], request.params[3]);
— FundTransaction(pwallet, rawTx, fee, change_position, request.params[4]);
+ // Make a copy and edit replaceability in-place
+ UniValue params_copy(request.params[4]);
+ if (!request.params[3].isNull()){
+ params_copy.pushKV(«replaceable», request.params[3].get_bool());
+ }
+ FundTransaction(pwallet, rawTx, fee, change_position, params_copy[4]);

This should just be `params_copy`, not `params_copy[4]`.

> @@ -4718,7 +4717,12 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
CAmount fee;
int change_position;
CMutableTransaction rawTx = ConstructTransaction(request.params[0], request.params[1], request.params[2], request.params[3]);
— FundTransaction(pwallet, rawTx, fee, change_position, request.params[4]);
+ // Make a copy and edit replaceability in-place
+ UniValue params_copy(request.params[4]);
+ if (!request.params[3].isNull()){
+ params_copy.pushKV(«replaceable», request.params[3].get_bool());

Suppose someone already has `replaceable` set in their options (because they copied it from `fundrawtransaction` or something). How does this interact with that?

Добавить комментарий