mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
listpeers: include feerate info for RBF-candidate channels
Changelog-Added: JSON-RPC: `listpeers` now includes 'last_feerate', 'next_feerate', 'initial_feerate' and 'next_fee_step' for channels in state DUALOPEND_AWAITING_LOCKIN fixup! listpeers: include feerate info for RBF-candidate channels
This commit is contained in:
parent
6c76dd338e
commit
dfdf9259d7
@ -759,6 +759,35 @@ static void json_add_channel(struct lightningd *ld,
|
|||||||
type_to_string(tmpctx, struct channel_id, &channel->cid));
|
type_to_string(tmpctx, struct channel_id, &channel->cid));
|
||||||
json_add_txid(response, "funding_txid", &channel->funding_txid);
|
json_add_txid(response, "funding_txid", &channel->funding_txid);
|
||||||
|
|
||||||
|
if (channel->state == DUALOPEND_AWAITING_LOCKIN) {
|
||||||
|
struct channel_inflight *initial;
|
||||||
|
u32 last_feerate, next_feerate, feerate;
|
||||||
|
u8 feestep;
|
||||||
|
|
||||||
|
last_feerate = channel_last_funding_feerate(channel);
|
||||||
|
assert(last_feerate > 0);
|
||||||
|
next_feerate = last_feerate + last_feerate / 4;
|
||||||
|
|
||||||
|
initial = list_top(&channel->inflights,
|
||||||
|
struct channel_inflight, list);
|
||||||
|
feerate = initial->funding->feerate;
|
||||||
|
|
||||||
|
json_add_string(response, "initial_feerate",
|
||||||
|
tal_fmt(tmpctx, "%d%s", feerate,
|
||||||
|
feerate_style_name(FEERATE_PER_KSIPA)));
|
||||||
|
json_add_string(response, "last_feerate",
|
||||||
|
tal_fmt(tmpctx, "%d%s", last_feerate,
|
||||||
|
feerate_style_name(FEERATE_PER_KSIPA)));
|
||||||
|
json_add_string(response, "next_feerate",
|
||||||
|
tal_fmt(tmpctx, "%d%s", next_feerate,
|
||||||
|
feerate_style_name(FEERATE_PER_KSIPA)));
|
||||||
|
|
||||||
|
/* Now we derive the feestep */
|
||||||
|
for (feestep = 0; feerate < next_feerate; feestep++)
|
||||||
|
feerate += feerate / 4;
|
||||||
|
json_add_num(response, "next_fee_step", feestep);
|
||||||
|
}
|
||||||
|
|
||||||
if (channel->shutdown_scriptpubkey[LOCAL]) {
|
if (channel->shutdown_scriptpubkey[LOCAL]) {
|
||||||
char *addr = encode_scriptpubkey_to_addr(tmpctx,
|
char *addr = encode_scriptpubkey_to_addr(tmpctx,
|
||||||
chainparams,
|
chainparams,
|
||||||
|
@ -82,6 +82,9 @@ struct htlc_out *channel_has_htlc_out(struct channel *channel UNNEEDED)
|
|||||||
/* Generated stub for channel_internal_error */
|
/* Generated stub for channel_internal_error */
|
||||||
void channel_internal_error(struct channel *channel UNNEEDED, const char *fmt UNNEEDED, ...)
|
void channel_internal_error(struct channel *channel UNNEEDED, const char *fmt UNNEEDED, ...)
|
||||||
{ fprintf(stderr, "channel_internal_error called!\n"); abort(); }
|
{ fprintf(stderr, "channel_internal_error called!\n"); abort(); }
|
||||||
|
/* Generated stub for channel_last_funding_feerate */
|
||||||
|
u32 channel_last_funding_feerate(const struct channel *channel UNNEEDED)
|
||||||
|
{ fprintf(stderr, "channel_last_funding_feerate called!\n"); abort(); }
|
||||||
/* Generated stub for channel_set_billboard */
|
/* Generated stub for channel_set_billboard */
|
||||||
void channel_set_billboard(struct channel *channel UNNEEDED, bool perm UNNEEDED,
|
void channel_set_billboard(struct channel *channel UNNEEDED, bool perm UNNEEDED,
|
||||||
const char *str TAKES UNNEEDED)
|
const char *str TAKES UNNEEDED)
|
||||||
|
Loading…
Reference in New Issue
Block a user