mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-12-27 09:04:40 +01:00
41b379ed89
Before this patch: 1. connectd says it's connected (peer_connected) 2. we tell connectd we want to talk about each channel (peer_make_active) 3. connectd gives us an fd for each channel, and we connect it to a subd (peer_active) 4. OR, connectd says it sent something about a channel we didn't tell it about, with an fd (peer_active) Now: 1. connectd says it's connected (peer_connected) 2. we start all appropriate subds and tell connectd to what channels/fds (peer_connect_subd). 3. if connectd says it sent something about a channel we didn't tell it about, we either tell it to hang up (peer_final_msg), or connect a new opening daemon (peer_connect_subd). This is the minimal-size patch, which is why we create socket pairs in so many places to use the existing functions. Many cleanups are possible, since the new flow is so simple. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
47 lines
1.4 KiB
C
47 lines
1.4 KiB
C
#ifndef LIGHTNING_LIGHTNINGD_CHANNEL_CONTROL_H
|
|
#define LIGHTNING_LIGHTNINGD_CHANNEL_CONTROL_H
|
|
#include "config.h"
|
|
#include <ccan/short_types/short_types.h>
|
|
#include <stdbool.h>
|
|
|
|
struct channel;
|
|
struct crypto_state;
|
|
struct lightningd;
|
|
struct peer_fd;
|
|
struct peer;
|
|
|
|
bool peer_start_channeld(struct channel *channel,
|
|
struct peer_fd *peer_fd,
|
|
const u8 *fwd_msg,
|
|
bool reconnected,
|
|
bool reestablish_only);
|
|
|
|
/* Returns true if subd told, otherwise false. */
|
|
bool channel_tell_depth(struct lightningd *ld,
|
|
struct channel *channel,
|
|
const struct bitcoin_txid *txid,
|
|
u32 depth);
|
|
/* Notify channels of new blocks. */
|
|
void channel_notify_new_block(struct lightningd *ld,
|
|
u32 block_height);
|
|
|
|
/* Cancel the channel after `fundchannel_complete` succeeds
|
|
* but before funding broadcasts. */
|
|
struct command_result *cancel_channel_before_broadcast(struct command *cmd,
|
|
struct peer *peer);
|
|
|
|
/* Update the channel info on funding locked */
|
|
bool channel_on_funding_locked(struct channel *channel,
|
|
struct pubkey *next_per_commitment_point);
|
|
|
|
/* Record channel open (coin movement notifications) */
|
|
void channel_record_open(struct channel *channel);
|
|
|
|
/* A channel has unrecoverably fallen behind */
|
|
void channel_fallen_behind(struct channel *channel, const u8 *msg);
|
|
|
|
/* Fresh channel_update for this channel. */
|
|
void channel_replace_update(struct channel *channel, u8 *update TAKES);
|
|
|
|
#endif /* LIGHTNING_LIGHTNINGD_CHANNEL_CONTROL_H */
|