mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +01:00
subd: swap out the channel + error callback
dual funding now swaps out the subdaemon's 'channel' struct in the middle of daemon existence, so we update the channel and error callback here.
This commit is contained in:
parent
21a1f71732
commit
c8aa6d4a55
2 changed files with 40 additions and 0 deletions
|
@ -822,6 +822,21 @@ void subd_release_channel(struct subd *owner, void *channel)
|
|||
}
|
||||
}
|
||||
|
||||
void subd_swap_channel_(struct subd *daemon, void *channel,
|
||||
void (*errcb)(void *channel,
|
||||
struct per_peer_state *pps,
|
||||
const struct channel_id *channel_id,
|
||||
const char *desc,
|
||||
bool soft_error,
|
||||
const u8 *err_for_them),
|
||||
void (*billboardcb)(void *channel, bool perm,
|
||||
const char *happenings))
|
||||
{
|
||||
daemon->channel = channel;
|
||||
daemon->errcb = errcb;
|
||||
daemon->billboardcb = billboardcb;
|
||||
}
|
||||
|
||||
#if DEVELOPER
|
||||
char *opt_subd_dev_disconnect(const char *optarg, struct lightningd *ld)
|
||||
{
|
||||
|
|
|
@ -145,6 +145,31 @@ struct subd *new_channel_subd_(struct lightningd *ld,
|
|||
const char *), \
|
||||
__VA_ARGS__)
|
||||
|
||||
/* subd_swap_channel - Swap the daemon's channel out */
|
||||
#define subd_swap_channel(subd, channel, errcb, billboardcb) \
|
||||
subd_swap_channel_((subd), (channel), \
|
||||
typesafe_cb_postargs(void, void *, \
|
||||
(errcb), \
|
||||
(channel), \
|
||||
struct per_peer_state *,\
|
||||
const struct channel_id *, \
|
||||
const char *, bool, \
|
||||
const u8 *), \
|
||||
typesafe_cb_postargs(void, void *, (billboardcb), \
|
||||
(channel), bool, \
|
||||
const char *))
|
||||
|
||||
void subd_swap_channel_(struct subd *daemon, void *channel,
|
||||
void (*errcb)(void *channel,
|
||||
struct per_peer_state *pps,
|
||||
const struct channel_id *channel_id,
|
||||
const char *desc,
|
||||
bool soft_error,
|
||||
const u8 *err_for_them),
|
||||
void (*billboardcb)(void *channel, bool perm,
|
||||
const char *happenings));
|
||||
|
||||
|
||||
/**
|
||||
* subd_send_msg - queue a message to the subdaemon.
|
||||
* @sd: subdaemon to request
|
||||
|
|
Loading…
Add table
Reference in a new issue