mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
lightningd: add channel_closed helper, expose find_channel_by_id().
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
b223a6acbb
commit
6afb9f8fe7
@ -363,6 +363,10 @@ struct channel *any_channel_by_scid(struct lightningd *ld,
|
||||
struct channel *channel_by_cid(struct lightningd *ld,
|
||||
const struct channel_id *cid);
|
||||
|
||||
/* Find this channel within peer */
|
||||
struct channel *find_channel_by_id(const struct peer *peer,
|
||||
const struct channel_id *cid);
|
||||
|
||||
void channel_set_last_tx(struct channel *channel,
|
||||
struct bitcoin_tx *tx,
|
||||
const struct bitcoin_signature *sig,
|
||||
@ -403,6 +407,15 @@ static inline bool channel_active(const struct channel *channel)
|
||||
&& !channel_on_chain(channel);
|
||||
}
|
||||
|
||||
static inline bool channel_closed(const struct channel *channel)
|
||||
{
|
||||
return channel->state == CLOSINGD_COMPLETE
|
||||
|| channel->state == AWAITING_UNILATERAL
|
||||
|| channel->state == FUNDING_SPEND_SEEN
|
||||
|| channel->state == ONCHAIN
|
||||
|| channel->state == CLOSED;
|
||||
}
|
||||
|
||||
void get_channel_basepoints(struct lightningd *ld,
|
||||
const struct node_id *peer_id,
|
||||
const u64 dbid,
|
||||
|
@ -788,8 +788,8 @@ void channel_notify_new_block(struct lightningd *ld,
|
||||
tal_free(to_forget);
|
||||
}
|
||||
|
||||
static struct channel *find_channel_by_id(const struct peer *peer,
|
||||
const struct channel_id *cid)
|
||||
struct channel *find_channel_by_id(const struct peer *peer,
|
||||
const struct channel_id *cid)
|
||||
{
|
||||
struct channel *c;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user