From aa1b8296c7c5ea4228b8ae77bda83a800aca65d2 Mon Sep 17 00:00:00 2001 From: niftynei Date: Fri, 11 Sep 2020 14:05:29 -0500 Subject: [PATCH] peer_control: move open_command up to where channeld can get it, also include a method for finding a pending/available open_command for a channel --- lightningd/peer_control.c | 13 +------------ lightningd/peer_control.h | 11 ++++++++++- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 19cd91ea1..4158ad2ae 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -74,17 +74,6 @@ struct close_command { bool force; }; -struct open_command { - /* Inside struct lightningd open_commands. */ - struct list_node list; - /* Command structure. This is the parent of the open command. */ - struct command *cmd; - /* Channel being opened. */ - struct channel *channel; - /* PSBT in flight */ - struct wally_psbt *psbt; -}; - static void destroy_peer(struct peer *peer) { list_del_from(&peer->ld->peers, &peer->list); @@ -367,7 +356,7 @@ destroy_open_command(struct open_command *oc) } struct open_command *find_open_command(struct lightningd *ld, - struct channel *channel) + const struct channel *channel) { struct open_command *oc, *n; diff --git a/lightningd/peer_control.h b/lightningd/peer_control.h index 10619a6de..85a5a4528 100644 --- a/lightningd/peer_control.h +++ b/lightningd/peer_control.h @@ -52,6 +52,15 @@ struct peer { #endif }; +struct open_command { + /* Inside struct lightningd open_commands. */ + struct list_node list; + /* Command structure. This is the parent of the open command. */ + struct command *cmd; + /* Channel being opened. */ + struct channel *channel; +}; + struct peer *find_peer_by_dbid(struct lightningd *ld, u64 dbid); struct peer *new_peer(struct lightningd *ld, u64 dbid, @@ -92,7 +101,7 @@ struct amount_msat channel_amount_receivable(const struct channel *channel); /* Find the open command that was registered for this channel */ struct open_command *find_open_command(struct lightningd *ld, - struct channel *channel); + const struct channel *channel); /* Save an `openchannel_signed` command */ void register_open_command(struct lightningd *ld,