mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
channel: move inflight + feerate methods to channel.c
Need these more accessible for next patch, which moves the next_feerate info into listpeers
This commit is contained in:
parent
a23277af57
commit
6c76dd338e
@ -715,6 +715,29 @@ void channel_fail_forget(struct channel *channel, const char *fmt, ...)
|
|||||||
tal_free(why);
|
tal_free(why);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct channel_inflight *
|
||||||
|
channel_current_inflight(const struct channel *channel)
|
||||||
|
{
|
||||||
|
struct channel_inflight *inflight;
|
||||||
|
/* The last inflight should always be the one in progress */
|
||||||
|
inflight = list_tail(&channel->inflights,
|
||||||
|
struct channel_inflight,
|
||||||
|
list);
|
||||||
|
if (inflight)
|
||||||
|
assert(bitcoin_txid_eq(&channel->funding_txid,
|
||||||
|
&inflight->funding->txid));
|
||||||
|
return inflight;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 channel_last_funding_feerate(const struct channel *channel)
|
||||||
|
{
|
||||||
|
struct channel_inflight *inflight;
|
||||||
|
inflight = channel_current_inflight(channel);
|
||||||
|
if (!inflight)
|
||||||
|
return 0;
|
||||||
|
return inflight->funding->feerate;
|
||||||
|
}
|
||||||
|
|
||||||
void channel_internal_error(struct channel *channel, const char *fmt, ...)
|
void channel_internal_error(struct channel *channel, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -286,6 +286,13 @@ new_inflight(struct channel *channel,
|
|||||||
struct channel_inflight *channel_inflight_find(struct channel *channel,
|
struct channel_inflight *channel_inflight_find(struct channel *channel,
|
||||||
const struct bitcoin_txid *txid);
|
const struct bitcoin_txid *txid);
|
||||||
|
|
||||||
|
/* What's the most recent inflight for this channel? */
|
||||||
|
struct channel_inflight *
|
||||||
|
channel_current_inflight(const struct channel *channel);
|
||||||
|
|
||||||
|
/* What's the last feerate used for a funding tx on this channel? */
|
||||||
|
u32 channel_last_funding_feerate(const struct channel *channel);
|
||||||
|
|
||||||
void delete_channel(struct channel *channel STEALS);
|
void delete_channel(struct channel *channel STEALS);
|
||||||
|
|
||||||
const char *channel_state_name(const struct channel *channel);
|
const char *channel_state_name(const struct channel *channel);
|
||||||
|
@ -119,21 +119,6 @@ void json_add_unsaved_channel(struct json_stream *response,
|
|||||||
json_object_end(response);
|
json_object_end(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct channel_inflight *
|
|
||||||
channel_current_inflight(struct channel *channel)
|
|
||||||
{
|
|
||||||
struct channel_inflight *inflight;
|
|
||||||
/* The last inflight should always be the one in progress */
|
|
||||||
inflight = list_tail(&channel->inflights,
|
|
||||||
struct channel_inflight,
|
|
||||||
list);
|
|
||||||
if (inflight)
|
|
||||||
assert(bitcoin_txid_eq(&channel->funding_txid,
|
|
||||||
&inflight->funding->txid));
|
|
||||||
return inflight;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handle_signed_psbt(struct lightningd *ld,
|
static void handle_signed_psbt(struct lightningd *ld,
|
||||||
struct subd *dualopend,
|
struct subd *dualopend,
|
||||||
const struct wally_psbt *psbt,
|
const struct wally_psbt *psbt,
|
||||||
|
Loading…
Reference in New Issue
Block a user