mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
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:
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user