prepare-tx: pass back the feerate, as json_tx_prepare sometimes sets it

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
This commit is contained in:
niftynei 2020-06-09 18:44:19 -05:00 committed by Christian Decker
parent 57f6f74ee0
commit b90be4f6c8

View File

@ -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;
@ -430,6 +431,8 @@ create_tx:
bitcoin_txid((*utx)->tx, &(*utx)->txid);
if (feerate)
*feerate = *feerate_per_kw;
return NULL;
}
@ -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;
@ -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;