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
This commit is contained in:
niftynei 2020-09-11 14:05:29 -05:00 committed by Rusty Russell
parent 46641951fa
commit aa1b8296c7
2 changed files with 11 additions and 13 deletions

View File

@ -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;

View File

@ -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,