2018-02-20 21:59:09 +01:00
|
|
|
#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;
|
2018-04-23 12:08:01 +02:00
|
|
|
struct lightningd;
|
2019-06-03 20:11:25 +02:00
|
|
|
struct per_peer_state;
|
2020-08-28 05:56:32 +02:00
|
|
|
struct peer;
|
2018-02-20 21:59:09 +01:00
|
|
|
|
2018-08-09 02:26:30 +02:00
|
|
|
void peer_start_channeld(struct channel *channel,
|
2019-06-03 20:11:25 +02:00
|
|
|
struct per_peer_state *pps,
|
2020-09-10 21:34:18 +02:00
|
|
|
const u8 *fwd_msg,
|
2018-02-20 21:59:09 +01:00
|
|
|
bool reconnected);
|
|
|
|
|
2018-04-23 12:08:01 +02:00
|
|
|
/* Returns true if subd told, otherwise false. */
|
2019-02-26 17:57:19 +01:00
|
|
|
bool channel_tell_depth(struct lightningd *ld,
|
2018-04-23 12:08:01 +02:00
|
|
|
struct channel *channel,
|
2018-05-17 07:08:11 +02:00
|
|
|
const struct bitcoin_txid *txid,
|
|
|
|
u32 depth);
|
2018-05-06 15:32:01 +02:00
|
|
|
/* Notify channels of new blocks. */
|
|
|
|
void channel_notify_new_block(struct lightningd *ld,
|
|
|
|
u32 block_height);
|
2018-04-23 12:08:01 +02:00
|
|
|
|
2019-08-23 23:34:52 +02:00
|
|
|
/* Cancel the channel after `fundchannel_complete` succeeds
|
|
|
|
* but before funding broadcasts. */
|
|
|
|
struct command_result *cancel_channel_before_broadcast(struct command *cmd,
|
2020-06-24 06:34:26 +02:00
|
|
|
struct peer *peer);
|
2019-08-23 23:34:52 +02:00
|
|
|
|
2020-11-24 02:24:50 +01:00
|
|
|
/* Update the channel info on funding locked */
|
|
|
|
bool channel_on_funding_locked(struct channel *channel,
|
|
|
|
struct pubkey *next_per_commitment_point);
|
2020-11-24 02:25:54 +01:00
|
|
|
|
|
|
|
/* Record channel open (coin movement notifications) */
|
|
|
|
void channel_record_open(struct channel *channel);
|
2019-12-12 01:23:19 +01:00
|
|
|
/* Forget a channel. Deletes the channel and handles all
|
|
|
|
* associated waiting commands, if present. Notifies peer if available */
|
|
|
|
void forget_channel(struct channel *channel, const char *err_msg);
|
2020-12-10 21:02:02 +01:00
|
|
|
|
|
|
|
/* A channel has unrecoverably fallen behind */
|
|
|
|
void channel_fallen_behind(struct channel *channel, const u8 *msg);
|
2018-02-20 21:59:09 +01:00
|
|
|
#endif /* LIGHTNING_LIGHTNINGD_CHANNEL_CONTROL_H */
|