Skip to content

Commit

Permalink
prepare-tx: pass back the feerate, as json_tx_prepare sometimes sets it
Browse files Browse the repository at this point in the history
Unused here, but we'll use it in the next commit so that we can always
pass back the effective / used feerate to the caller of `reserveinputs`

This makes opening a channel much easier if we've internally determined
the feerate
  • Loading branch information
niftynei committed Jun 16, 2020
1 parent a82fe89 commit 569efe8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions wallet/walletrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@ static struct command_result *broadcast_and_wait(struct command *cmd,
static struct command_result *json_prepare_tx(struct command *cmd,
const char *buffer,
const jsmntok_t *params,
bool for_withdraw,
struct unreleased_tx **utx,
bool for_withdraw)
u32 *feerate)
{
u32 *feerate_per_kw = NULL;
struct command_result *result;
Expand Down Expand Up @@ -430,6 +431,8 @@ static struct command_result *json_prepare_tx(struct command *cmd,

bitcoin_txid((*utx)->tx, &(*utx)->txid);

if (feerate)
*feerate = *feerate_per_kw;
return NULL;
}

Expand All @@ -442,7 +445,7 @@ static struct command_result *json_txprepare(struct command *cmd,
struct command_result *res;
struct json_stream *response;

res = json_prepare_tx(cmd, buffer, params, &utx, false);
res = json_prepare_tx(cmd, buffer, params, false, &utx, NULL);
if (res)
return res;

Expand Down Expand Up @@ -569,7 +572,7 @@ static struct command_result *json_withdraw(struct command *cmd,
struct unreleased_tx *utx;
struct command_result *res;

res = json_prepare_tx(cmd, buffer, params, &utx, true);
res = json_prepare_tx(cmd, buffer, params, true, &utx, NULL);
if (res)
return res;

Expand Down

0 comments on commit 569efe8

Please sign in to comment.