Browse Source

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
travis-experimental
niftynei 4 years ago
committed by Rusty Russell
parent
commit
aa1b8296c7
  1. 13
      lightningd/peer_control.c
  2. 11
      lightningd/peer_control.h

13
lightningd/peer_control.c

@ -74,17 +74,6 @@ struct close_command {
bool force; 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) static void destroy_peer(struct peer *peer)
{ {
list_del_from(&peer->ld->peers, &peer->list); 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 open_command *find_open_command(struct lightningd *ld,
struct channel *channel) const struct channel *channel)
{ {
struct open_command *oc, *n; struct open_command *oc, *n;

11
lightningd/peer_control.h

@ -52,6 +52,15 @@ struct peer {
#endif #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 *find_peer_by_dbid(struct lightningd *ld, u64 dbid);
struct peer *new_peer(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 */ /* Find the open command that was registered for this channel */
struct open_command *find_open_command(struct lightningd *ld, struct open_command *find_open_command(struct lightningd *ld,
struct channel *channel); const struct channel *channel);
/* Save an `openchannel_signed` command */ /* Save an `openchannel_signed` command */
void register_open_command(struct lightningd *ld, void register_open_command(struct lightningd *ld,

Loading…
Cancel
Save