patch lightningd-peer-fds.patch

This commit is contained in:
Rusty Russell
2022-01-11 11:43:59 +10:30
parent 6115ed02e8
commit 741f44725a
22 changed files with 160 additions and 135 deletions

View File

@@ -29,6 +29,7 @@ LIGHTNINGD_SRC := \
lightningd/options.c \ lightningd/options.c \
lightningd/pay.c \ lightningd/pay.c \
lightningd/peer_control.c \ lightningd/peer_control.c \
lightningd/peer_fd.c \
lightningd/peer_htlcs.c \ lightningd/peer_htlcs.c \
lightningd/ping.c \ lightningd/ping.c \
lightningd/plugin.c \ lightningd/plugin.c \

View File

@@ -6,7 +6,6 @@
#include <common/json_tok.h> #include <common/json_tok.h>
#include <common/memleak.h> #include <common/memleak.h>
#include <common/param.h> #include <common/param.h>
#include <common/per_peer_state.h>
#include <common/shutdown_scriptpubkey.h> #include <common/shutdown_scriptpubkey.h>
#include <common/type_to_string.h> #include <common/type_to_string.h>
#include <common/wire_error.h> #include <common/wire_error.h>
@@ -21,6 +20,7 @@
#include <lightningd/hsm_control.h> #include <lightningd/hsm_control.h>
#include <lightningd/notification.h> #include <lightningd/notification.h>
#include <lightningd/peer_control.h> #include <lightningd/peer_control.h>
#include <lightningd/peer_fd.h>
#include <lightningd/ping.h> #include <lightningd/ping.h>
#include <wire/common_wiregen.h> #include <wire/common_wiregen.h>
@@ -356,18 +356,17 @@ static void peer_start_closingd_after_shutdown(struct channel *channel,
const u8 *msg, const u8 *msg,
const int *fds) const int *fds)
{ {
struct per_peer_state *pps; struct peer_fd *peer_fd;
if (!fromwire_channeld_shutdown_complete(msg)) { if (!fromwire_channeld_shutdown_complete(msg)) {
channel_internal_error(channel, "bad shutdown_complete: %s", channel_internal_error(channel, "bad shutdown_complete: %s",
tal_hex(msg, msg)); tal_hex(msg, msg));
return; return;
} }
pps = new_per_peer_state(msg); peer_fd = new_peer_fd_arr(msg, fds);
per_peer_state_set_fds_arr(pps, fds);
/* This sets channel->owner, closes down channeld. */ /* This sets channel->owner, closes down channeld. */
peer_start_closingd(channel, pps); peer_start_closingd(channel, peer_fd);
/* We might have reconnected, so already be here. */ /* We might have reconnected, so already be here. */
if (!channel_closed(channel) if (!channel_closed(channel)
@@ -551,7 +550,7 @@ static unsigned channel_msg(struct subd *sd, const u8 *msg, const int *fds)
} }
void peer_start_channeld(struct channel *channel, void peer_start_channeld(struct channel *channel,
struct per_peer_state *pps, struct peer_fd *peer_fd,
const u8 *fwd_msg, const u8 *fwd_msg,
bool reconnected, bool reconnected,
const u8 *reestablish_only) const u8 *reestablish_only)
@@ -586,8 +585,8 @@ void peer_start_channeld(struct channel *channel,
channel_msg, channel_msg,
channel_errmsg, channel_errmsg,
channel_set_billboard, channel_set_billboard,
take(&pps->peer_fd), take(&peer_fd->fd),
take(&pps->gossip_fd), take(&peer_fd->gossip_fd),
take(&hsmfd), NULL)); take(&hsmfd), NULL));
if (!channel->owner) { if (!channel->owner) {

View File

@@ -7,11 +7,11 @@
struct channel; struct channel;
struct crypto_state; struct crypto_state;
struct lightningd; struct lightningd;
struct per_peer_state; struct peer_fd;
struct peer; struct peer;
void peer_start_channeld(struct channel *channel, void peer_start_channeld(struct channel *channel,
struct per_peer_state *pps, struct peer_fd *peer_fd,
const u8 *fwd_msg, const u8 *fwd_msg,
bool reconnected, bool reconnected,
const u8 *reestablish_only); const u8 *reestablish_only);

View File

@@ -14,7 +14,6 @@
#include <common/json_helpers.h> #include <common/json_helpers.h>
#include <common/json_tok.h> #include <common/json_tok.h>
#include <common/param.h> #include <common/param.h>
#include <common/per_peer_state.h>
#include <common/shutdown_scriptpubkey.h> #include <common/shutdown_scriptpubkey.h>
#include <common/timeout.h> #include <common/timeout.h>
#include <common/type_to_string.h> #include <common/type_to_string.h>
@@ -36,6 +35,7 @@
#include <lightningd/opening_common.h> #include <lightningd/opening_common.h>
#include <lightningd/options.h> #include <lightningd/options.h>
#include <lightningd/peer_control.h> #include <lightningd/peer_control.h>
#include <lightningd/peer_fd.h>
#include <lightningd/subd.h> #include <lightningd/subd.h>
#include <openingd/dualopend_wiregen.h> #include <openingd/dualopend_wiregen.h>
#include <wire/common_wiregen.h> #include <wire/common_wiregen.h>
@@ -349,7 +349,7 @@ static unsigned closing_msg(struct subd *sd, const u8 *msg, const int *fds UNUSE
} }
void peer_start_closingd(struct channel *channel, void peer_start_closingd(struct channel *channel,
struct per_peer_state *pps) struct peer_fd *peer_fd)
{ {
u8 *initmsg; u8 *initmsg;
u32 min_feerate, feerate, *max_feerate; u32 min_feerate, feerate, *max_feerate;
@@ -378,8 +378,8 @@ void peer_start_closingd(struct channel *channel,
closingd_wire_name, closing_msg, closingd_wire_name, closing_msg,
channel_errmsg, channel_errmsg,
channel_set_billboard, channel_set_billboard,
take(&pps->peer_fd), take(&peer_fd->fd),
take(&pps->gossip_fd), take(&peer_fd->gossip_fd),
take(&hsmfd), take(&hsmfd),
NULL)); NULL));

View File

@@ -6,12 +6,12 @@
struct channel; struct channel;
struct lightningd; struct lightningd;
struct per_peer_state; struct peer_fd;
void resolve_close_command(struct lightningd *ld, struct channel *channel, void resolve_close_command(struct lightningd *ld, struct channel *channel,
bool cooperative); bool cooperative);
void peer_start_closingd(struct channel *channel, void peer_start_closingd(struct channel *channel,
struct per_peer_state *pps); struct peer_fd *peer_fd);
#endif /* LIGHTNING_LIGHTNINGD_CLOSING_CONTROL_H */ #endif /* LIGHTNING_LIGHTNINGD_CLOSING_CONTROL_H */

View File

@@ -12,7 +12,6 @@
#include <common/json_helpers.h> #include <common/json_helpers.h>
#include <common/json_tok.h> #include <common/json_tok.h>
#include <common/param.h> #include <common/param.h>
#include <common/per_peer_state.h>
#include <common/psbt_open.h> #include <common/psbt_open.h>
#include <common/shutdown_scriptpubkey.h> #include <common/shutdown_scriptpubkey.h>
#include <common/type_to_string.h> #include <common/type_to_string.h>
@@ -28,6 +27,7 @@
#include <lightningd/notification.h> #include <lightningd/notification.h>
#include <lightningd/opening_common.h> #include <lightningd/opening_common.h>
#include <lightningd/peer_control.h> #include <lightningd/peer_control.h>
#include <lightningd/peer_fd.h>
#include <lightningd/plugin_hook.h> #include <lightningd/plugin_hook.h>
#include <openingd/dualopend_wiregen.h> #include <openingd/dualopend_wiregen.h>
#include <wire/common_wiregen.h> #include <wire/common_wiregen.h>
@@ -1346,7 +1346,7 @@ static void handle_channel_closed(struct subd *dualopend,
const int *fds, const int *fds,
const u8 *msg) const u8 *msg)
{ {
struct per_peer_state *pps; struct peer_fd *peer_fd;
struct channel *channel = dualopend->channel; struct channel *channel = dualopend->channel;
if (!fromwire_dualopend_shutdown_complete(msg)) { if (!fromwire_dualopend_shutdown_complete(msg)) {
@@ -1358,10 +1358,9 @@ static void handle_channel_closed(struct subd *dualopend,
return; return;
} }
pps = new_per_peer_state(tmpctx); peer_fd = new_peer_fd_arr(tmpctx, fds);
per_peer_state_set_fds_arr(pps, fds);
peer_start_closingd(channel, pps); peer_start_closingd(channel, peer_fd);
channel_set_state(channel, channel_set_state(channel,
CHANNELD_SHUTTING_DOWN, CHANNELD_SHUTTING_DOWN,
CLOSINGD_SIGEXCHANGE, CLOSINGD_SIGEXCHANGE,
@@ -1629,7 +1628,7 @@ static void handle_channel_locked(struct subd *dualopend,
const u8 *msg) const u8 *msg)
{ {
struct channel *channel = dualopend->channel; struct channel *channel = dualopend->channel;
struct per_peer_state *pps; struct peer_fd *peer_fd;
if (!fromwire_dualopend_channel_locked(msg)) { if (!fromwire_dualopend_channel_locked(msg)) {
channel_internal_error(channel, channel_internal_error(channel,
@@ -1637,8 +1636,7 @@ static void handle_channel_locked(struct subd *dualopend,
tal_hex(msg, msg)); tal_hex(msg, msg));
return; return;
} }
pps = new_per_peer_state(tmpctx); peer_fd = new_peer_fd_arr(tmpctx, fds);
per_peer_state_set_fds_arr(pps, fds);
assert(channel->scid); assert(channel->scid);
assert(channel->remote_funding_locked); assert(channel->remote_funding_locked);
@@ -1659,7 +1657,7 @@ static void handle_channel_locked(struct subd *dualopend,
wallet_channel_clear_inflights(dualopend->ld->wallet, channel); wallet_channel_clear_inflights(dualopend->ld->wallet, channel);
/* FIXME: LND sigs/update_fee msgs? */ /* FIXME: LND sigs/update_fee msgs? */
peer_start_channeld(channel, pps, NULL, false, NULL); peer_start_channeld(channel, peer_fd, NULL, false, NULL);
return; return;
} }
@@ -3198,7 +3196,7 @@ AUTODATA(json_command, &openchannel_bump_command);
AUTODATA(json_command, &openchannel_abort_command); AUTODATA(json_command, &openchannel_abort_command);
static void start_fresh_dualopend(struct peer *peer, static void start_fresh_dualopend(struct peer *peer,
struct per_peer_state *pps, struct peer_fd *peer_fd,
struct channel *channel) struct channel *channel)
{ {
int hsmfd; int hsmfd;
@@ -3220,8 +3218,8 @@ static void start_fresh_dualopend(struct peer *peer,
dual_opend_msg, dual_opend_msg,
channel_errmsg, channel_errmsg,
channel_set_billboard, channel_set_billboard,
take(&pps->peer_fd), take(&peer_fd->fd),
take(&pps->gossip_fd), take(&peer_fd->gossip_fd),
take(&hsmfd), NULL); take(&hsmfd), NULL);
if (!channel->owner) { if (!channel->owner) {
@@ -3258,7 +3256,7 @@ static void start_fresh_dualopend(struct peer *peer,
} }
void peer_restart_dualopend(struct peer *peer, void peer_restart_dualopend(struct peer *peer,
struct per_peer_state *pps, struct peer_fd *peer_fd,
struct channel *channel) struct channel *channel)
{ {
u32 max_to_self_delay, blockheight; u32 max_to_self_delay, blockheight;
@@ -3270,7 +3268,7 @@ void peer_restart_dualopend(struct peer *peer,
u8 *msg; u8 *msg;
if (channel_unsaved(channel)) { if (channel_unsaved(channel)) {
start_fresh_dualopend(peer, pps, channel); start_fresh_dualopend(peer, peer_fd, channel);
return; return;
} }
hsmfd = hsm_get_client_fd(peer->ld, &peer->id, channel->dbid, hsmfd = hsm_get_client_fd(peer->ld, &peer->id, channel->dbid,
@@ -3287,8 +3285,8 @@ void peer_restart_dualopend(struct peer *peer,
dual_opend_msg, dual_opend_msg,
channel_errmsg, channel_errmsg,
channel_set_billboard, channel_set_billboard,
take(&pps->peer_fd), take(&peer_fd->fd),
take(&pps->gossip_fd), take(&peer_fd->gossip_fd),
take(&hsmfd), NULL)); take(&hsmfd), NULL));
if (!channel->owner) { if (!channel->owner) {
log_broken(channel->log, "Could not subdaemon channel: %s", log_broken(channel->log, "Could not subdaemon channel: %s",
@@ -3362,7 +3360,7 @@ void peer_restart_dualopend(struct peer *peer,
subd_send_msg(channel->owner, take(msg)); subd_send_msg(channel->owner, take(msg));
} }
void peer_start_dualopend(struct peer *peer, struct per_peer_state *pps) void peer_start_dualopend(struct peer *peer, struct peer_fd *peer_fd)
{ {
struct channel *channel; struct channel *channel;
@@ -3372,5 +3370,5 @@ void peer_start_dualopend(struct peer *peer, struct per_peer_state *pps)
peer->ld->config.fee_base, peer->ld->config.fee_base,
peer->ld->config.fee_per_satoshi); peer->ld->config.fee_per_satoshi);
start_fresh_dualopend(peer, pps, channel); start_fresh_dualopend(peer, peer_fd, channel);
} }

View File

@@ -4,12 +4,12 @@
#include "config.h" #include "config.h"
#include <lightningd/subd.h> #include <lightningd/subd.h>
struct per_peer_state; struct peer_fd;
void peer_start_dualopend(struct peer *peer, struct per_peer_state *pps); void peer_start_dualopend(struct peer *peer, struct peer_fd *peer_fd);
void peer_restart_dualopend(struct peer *peer, void peer_restart_dualopend(struct peer *peer,
struct per_peer_state *pps, struct peer_fd *peer_fd,
struct channel *channel); struct channel *channel);
void dualopen_tell_depth(struct subd *dualopend, void dualopen_tell_depth(struct subd *dualopend,

View File

@@ -561,7 +561,7 @@ static unsigned int onchain_msg(struct subd *sd, const u8 *msg, const int *fds U
/* Only error onchaind can get is if it dies. */ /* Only error onchaind can get is if it dies. */
static void onchain_error(struct channel *channel, static void onchain_error(struct channel *channel,
struct per_peer_state *pps UNUSED, struct peer_fd *pps UNUSED,
const struct channel_id *channel_id UNUSED, const struct channel_id *channel_id UNUSED,
const char *desc, const char *desc,
bool warning UNUSED, bool warning UNUSED,

View File

@@ -1,7 +1,6 @@
#include "config.h" #include "config.h"
#include <ccan/ccan/tal/str/str.h> #include <ccan/ccan/tal/str/str.h>
#include <common/json_command.h> #include <common/json_command.h>
#include <common/per_peer_state.h>
#include <common/type_to_string.h> #include <common/type_to_string.h>
#include <common/wire_error.h> #include <common/wire_error.h>
#include <connectd/connectd_wiregen.h> #include <connectd/connectd_wiregen.h>
@@ -12,6 +11,7 @@
#include <lightningd/notification.h> #include <lightningd/notification.h>
#include <lightningd/opening_common.h> #include <lightningd/opening_common.h>
#include <lightningd/peer_control.h> #include <lightningd/peer_control.h>
#include <lightningd/peer_fd.h>
#include <lightningd/subd.h> #include <lightningd/subd.h>
#include <openingd/openingd_wiregen.h> #include <openingd/openingd_wiregen.h>
#include <wire/wire_sync.h> #include <wire/wire_sync.h>
@@ -76,14 +76,14 @@ new_uncommitted_channel(struct peer *peer)
} }
void opend_channel_errmsg(struct uncommitted_channel *uc, void opend_channel_errmsg(struct uncommitted_channel *uc,
struct per_peer_state *pps, struct peer_fd *peer_fd,
const struct channel_id *channel_id UNUSED, const struct channel_id *channel_id UNUSED,
const char *desc, const char *desc,
bool warning UNUSED, bool warning UNUSED,
const u8 *err_for_them UNUSED) const u8 *err_for_them UNUSED)
{ {
/* Close fds, if any. */ /* Close fds, if any. */
tal_free(pps); tal_free(peer_fd);
uncommitted_channel_disconnect(uc, LOG_INFORM, desc); uncommitted_channel_disconnect(uc, LOG_INFORM, desc);
tal_free(uc); tal_free(uc);
} }
@@ -169,7 +169,7 @@ void handle_reestablish(struct lightningd *ld,
const struct node_id *peer_id, const struct node_id *peer_id,
const struct channel_id *channel_id, const struct channel_id *channel_id,
const u8 *reestablish, const u8 *reestablish,
struct per_peer_state *pps) struct peer_fd *peer_fd)
{ {
struct peer *peer; struct peer *peer;
struct channel *c; struct channel *c;
@@ -185,7 +185,7 @@ void handle_reestablish(struct lightningd *ld,
if (c && channel_closed(c)) { if (c && channel_closed(c)) {
log_debug(c->log, "Reestablish on %s channel: using channeld to reply", log_debug(c->log, "Reestablish on %s channel: using channeld to reply",
channel_state_name(c)); channel_state_name(c));
peer_start_channeld(c, pps, NULL, true, reestablish); peer_start_channeld(c, peer_fd, NULL, true, reestablish);
} else { } else {
const u8 *err = towire_errorfmt(tmpctx, channel_id, const u8 *err = towire_errorfmt(tmpctx, channel_id,
"Unknown channel for reestablish"); "Unknown channel for reestablish");
@@ -194,12 +194,10 @@ void handle_reestablish(struct lightningd *ld,
subd_send_msg(ld->connectd, subd_send_msg(ld->connectd,
take(towire_connectd_peer_final_msg(NULL, peer_id, take(towire_connectd_peer_final_msg(NULL, peer_id,
err))); err)));
subd_send_fd(ld->connectd, pps->peer_fd); subd_send_fd(ld->connectd, peer_fd->fd);
subd_send_fd(ld->connectd, pps->gossip_fd); subd_send_fd(ld->connectd, peer_fd->gossip_fd);
/* Don't close those fds! */ /* Don't close those fds! */
pps->peer_fd peer_fd->fd = peer_fd->gossip_fd = -1;
= pps->gossip_fd
= -1;
} }
} }

View File

@@ -92,14 +92,14 @@ struct funding_channel {
/* Place to stash the per-peer-state while we wait /* Place to stash the per-peer-state while we wait
* for them to get back to us with signatures */ * for them to get back to us with signatures */
struct per_peer_state *pps; struct peer_fd *peer_fd;
}; };
struct uncommitted_channel * struct uncommitted_channel *
new_uncommitted_channel(struct peer *peer); new_uncommitted_channel(struct peer *peer);
void opend_channel_errmsg(struct uncommitted_channel *uc, void opend_channel_errmsg(struct uncommitted_channel *uc,
struct per_peer_state *pps, struct peer_fd *peer_fd,
const struct channel_id *channel_id UNUSED, const struct channel_id *channel_id UNUSED,
const char *desc, const char *desc,
bool warning UNUSED, bool warning UNUSED,
@@ -125,7 +125,7 @@ void handle_reestablish(struct lightningd *ld,
const struct node_id *peer_id, const struct node_id *peer_id,
const struct channel_id *channel_id, const struct channel_id *channel_id,
const u8 *reestablish, const u8 *reestablish,
struct per_peer_state *pps); struct peer_fd *peer_fd);
#if DEVELOPER #if DEVELOPER
struct command; struct command;

View File

@@ -12,7 +12,6 @@
#include <common/json_helpers.h> #include <common/json_helpers.h>
#include <common/json_tok.h> #include <common/json_tok.h>
#include <common/param.h> #include <common/param.h>
#include <common/per_peer_state.h>
#include <common/type_to_string.h> #include <common/type_to_string.h>
#include <errno.h> #include <errno.h>
#include <hsmd/capabilities.h> #include <hsmd/capabilities.h>
@@ -24,6 +23,7 @@
#include <lightningd/notification.h> #include <lightningd/notification.h>
#include <lightningd/opening_common.h> #include <lightningd/opening_common.h>
#include <lightningd/opening_control.h> #include <lightningd/opening_control.h>
#include <lightningd/peer_fd.h>
#include <lightningd/plugin_hook.h> #include <lightningd/plugin_hook.h>
#include <lightningd/subd.h> #include <lightningd/subd.h>
#include <openingd/openingd_wiregen.h> #include <openingd/openingd_wiregen.h>
@@ -337,7 +337,7 @@ static void opening_funder_finished(struct subd *openingd, const u8 *resp,
struct channel *channel; struct channel *channel;
struct lightningd *ld = openingd->ld; struct lightningd *ld = openingd->ld;
u8 *remote_upfront_shutdown_script; u8 *remote_upfront_shutdown_script;
struct per_peer_state *pps; struct peer_fd *peer_fd;
struct penalty_base *pbase; struct penalty_base *pbase;
struct channel_type *type; struct channel_type *type;
@@ -371,8 +371,7 @@ static void opening_funder_finished(struct subd *openingd, const u8 *resp,
} }
remote_commit->chainparams = chainparams; remote_commit->chainparams = chainparams;
pps = new_per_peer_state(resp); peer_fd = new_peer_fd_arr(resp, fds);
per_peer_state_set_fds_arr(pps, fds);
log_debug(ld->log, log_debug(ld->log,
"%s", type_to_string(tmpctx, struct pubkey, "%s", type_to_string(tmpctx, struct pubkey,
@@ -411,7 +410,7 @@ static void opening_funder_finished(struct subd *openingd, const u8 *resp,
wallet_penalty_base_add(ld->wallet, channel->dbid, pbase); wallet_penalty_base_add(ld->wallet, channel->dbid, pbase);
funding_success(channel); funding_success(channel);
peer_start_channeld(channel, pps, NULL, false, NULL); peer_start_channeld(channel, peer_fd, NULL, false, NULL);
cleanup: cleanup:
/* Frees fc too */ /* Frees fc too */
@@ -436,7 +435,7 @@ static void opening_fundee_finished(struct subd *openingd,
u8 channel_flags; u8 channel_flags;
struct channel *channel; struct channel *channel;
u8 *remote_upfront_shutdown_script, *local_upfront_shutdown_script; u8 *remote_upfront_shutdown_script, *local_upfront_shutdown_script;
struct per_peer_state *pps; struct peer_fd *peer_fd;
struct penalty_base *pbase; struct penalty_base *pbase;
struct channel_type *type; struct channel_type *type;
@@ -445,6 +444,7 @@ static void opening_fundee_finished(struct subd *openingd,
/* This is a new channel_info.their_config, set its ID to 0 */ /* This is a new channel_info.their_config, set its ID to 0 */
channel_info.their_config.id = 0; channel_info.their_config.id = 0;
peer_fd = new_peer_fd_arr(tmpctx, fds);
if (!fromwire_openingd_fundee(tmpctx, reply, if (!fromwire_openingd_fundee(tmpctx, reply,
&channel_info.their_config, &channel_info.their_config,
&remote_commit, &remote_commit,
@@ -474,8 +474,6 @@ static void opening_fundee_finished(struct subd *openingd,
} }
remote_commit->chainparams = chainparams; remote_commit->chainparams = chainparams;
pps = new_per_peer_state(tmpctx);
per_peer_state_set_fds_arr(pps, fds);
/* openingd should never accept them funding channel in this case. */ /* openingd should never accept them funding channel in this case. */
if (peer_active_channel(uc->peer)) { if (peer_active_channel(uc->peer)) {
@@ -524,14 +522,12 @@ static void opening_fundee_finished(struct subd *openingd,
wallet_penalty_base_add(ld->wallet, channel->dbid, pbase); wallet_penalty_base_add(ld->wallet, channel->dbid, pbase);
/* On to normal operation! */ /* On to normal operation! */
peer_start_channeld(channel, pps, fwd_msg, false, NULL); peer_start_channeld(channel, peer_fd, fwd_msg, false, NULL);
tal_free(uc); tal_free(uc);
return; return;
failed: failed:
close(fds[0]);
close(fds[1]);
tal_free(uc); tal_free(uc);
} }
@@ -811,7 +807,9 @@ static void opening_got_reestablish(struct subd *openingd, const u8 *msg,
struct node_id peer_id = uc->peer->id; struct node_id peer_id = uc->peer->id;
struct channel_id channel_id; struct channel_id channel_id;
u8 *reestablish; u8 *reestablish;
struct per_peer_state *pps; struct peer_fd *peer_fd;
peer_fd = new_peer_fd_arr(tmpctx, fds);
if (!fromwire_openingd_got_reestablish(tmpctx, msg, &channel_id, if (!fromwire_openingd_got_reestablish(tmpctx, msg, &channel_id,
&reestablish)) { &reestablish)) {
@@ -820,13 +818,11 @@ static void opening_got_reestablish(struct subd *openingd, const u8 *msg,
tal_free(openingd); tal_free(openingd);
return; return;
} }
pps = new_per_peer_state(tmpctx);
per_peer_state_set_fds_arr(pps, fds);
/* This could free peer */ /* This could free peer */
tal_free(uc); tal_free(uc);
handle_reestablish(ld, &peer_id, &channel_id, reestablish, pps); handle_reestablish(ld, &peer_id, &channel_id, reestablish, peer_fd);
} }
static unsigned int openingd_msg(struct subd *openingd, static unsigned int openingd_msg(struct subd *openingd,
@@ -909,7 +905,7 @@ static unsigned int openingd_msg(struct subd *openingd,
return 0; return 0;
} }
void peer_start_openingd(struct peer *peer, struct per_peer_state *pps) void peer_start_openingd(struct peer *peer, struct peer_fd *peer_fd)
{ {
int hsmfd; int hsmfd;
u32 max_to_self_delay; u32 max_to_self_delay;
@@ -932,8 +928,8 @@ void peer_start_openingd(struct peer *peer, struct per_peer_state *pps)
openingd_msg, openingd_msg,
opend_channel_errmsg, opend_channel_errmsg,
opend_channel_set_billboard, opend_channel_set_billboard,
take(&pps->peer_fd), take(&peer_fd->fd),
take(&pps->gossip_fd), take(&peer_fd->gossip_fd),
take(&hsmfd), NULL); take(&hsmfd), NULL);
if (!uc->open_daemon) { if (!uc->open_daemon) {
uncommitted_channel_disconnect(uc, LOG_BROKEN, uncommitted_channel_disconnect(uc, LOG_BROKEN,

View File

@@ -8,14 +8,14 @@ struct channel_id;
struct crypto_state; struct crypto_state;
struct json_stream; struct json_stream;
struct lightningd; struct lightningd;
struct per_peer_state; struct peer_fd;
struct uncommitted_channel; struct uncommitted_channel;
void json_add_uncommitted_channel(struct json_stream *response, void json_add_uncommitted_channel(struct json_stream *response,
const struct uncommitted_channel *uc); const struct uncommitted_channel *uc);
void peer_start_openingd(struct peer *peer, void peer_start_openingd(struct peer *peer,
struct per_peer_state *pps); struct peer_fd *peer_fd);
struct subd *peer_get_owning_subd(struct peer *peer); struct subd *peer_get_owning_subd(struct peer *peer);

View File

@@ -25,7 +25,6 @@
#include <common/jsonrpc_errors.h> #include <common/jsonrpc_errors.h>
#include <common/key_derive.h> #include <common/key_derive.h>
#include <common/param.h> #include <common/param.h>
#include <common/per_peer_state.h>
#include <common/shutdown_scriptpubkey.h> #include <common/shutdown_scriptpubkey.h>
#include <common/status.h> #include <common/status.h>
#include <common/timeout.h> #include <common/timeout.h>
@@ -57,6 +56,7 @@
#include <lightningd/opening_control.h> #include <lightningd/opening_control.h>
#include <lightningd/options.h> #include <lightningd/options.h>
#include <lightningd/peer_control.h> #include <lightningd/peer_control.h>
#include <lightningd/peer_fd.h>
#include <lightningd/peer_htlcs.h> #include <lightningd/peer_htlcs.h>
#include <lightningd/plugin_hook.h> #include <lightningd/plugin_hook.h>
#include <lightningd/subd.h> #include <lightningd/subd.h>
@@ -281,7 +281,7 @@ void drop_to_chain(struct lightningd *ld, struct channel *channel,
} }
void channel_errmsg(struct channel *channel, void channel_errmsg(struct channel *channel,
struct per_peer_state *pps, struct peer_fd *peer_fd,
const struct channel_id *channel_id UNUSED, const struct channel_id *channel_id UNUSED,
const char *desc, const char *desc,
bool warning, bool warning,
@@ -299,8 +299,8 @@ void channel_errmsg(struct channel *channel,
return; return;
} }
/* No per_peer_state means a subd crash or disconnection. */ /* No peer_fd means a subd crash or disconnection. */
if (!pps) { if (!peer_fd) {
/* If the channel is unsaved, we forget it */ /* If the channel is unsaved, we forget it */
channel_fail_reconnect(channel, "%s: %s", channel_fail_reconnect(channel, "%s: %s",
channel->owner->name, desc); channel->owner->name, desc);
@@ -931,7 +931,7 @@ struct peer_connected_hook_payload {
struct wireaddr_internal addr; struct wireaddr_internal addr;
bool incoming; bool incoming;
struct peer *peer; struct peer *peer;
struct per_peer_state *pps; struct peer_fd *peer_fd;
u8 *error; u8 *error;
}; };
@@ -1011,7 +1011,7 @@ static void peer_connected_hook_final(struct peer_connected_hook_payload *payloa
assert(!channel->owner); assert(!channel->owner);
channel->peer->addr = addr; channel->peer->addr = addr;
channel->peer->connected_incoming = payload->incoming; channel->peer->connected_incoming = payload->incoming;
peer_restart_dualopend(peer, payload->pps, channel); peer_restart_dualopend(peer, payload->peer_fd, channel);
return; return;
case CHANNELD_AWAITING_LOCKIN: case CHANNELD_AWAITING_LOCKIN:
case CHANNELD_NORMAL: case CHANNELD_NORMAL:
@@ -1020,7 +1020,7 @@ static void peer_connected_hook_final(struct peer_connected_hook_payload *payloa
assert(!channel->owner); assert(!channel->owner);
channel->peer->addr = addr; channel->peer->addr = addr;
channel->peer->connected_incoming = payload->incoming; channel->peer->connected_incoming = payload->incoming;
peer_start_channeld(channel, payload->pps, NULL, true, peer_start_channeld(channel, payload->peer_fd, NULL, true,
NULL); NULL);
return; return;
} }
@@ -1039,11 +1039,11 @@ static void peer_connected_hook_final(struct peer_connected_hook_payload *payloa
|| channel->state == AWAITING_UNILATERAL); || channel->state == AWAITING_UNILATERAL);
channel->peer->addr = addr; channel->peer->addr = addr;
channel->peer->connected_incoming = payload->incoming; channel->peer->connected_incoming = payload->incoming;
peer_restart_dualopend(peer, payload->pps, channel); peer_restart_dualopend(peer, payload->peer_fd, channel);
} else } else
peer_start_dualopend(peer, payload->pps); peer_start_dualopend(peer, payload->peer_fd);
} else } else
peer_start_openingd(peer, payload->pps); peer_start_openingd(peer, payload->peer_fd);
return; return;
send_error: send_error:
@@ -1053,12 +1053,10 @@ send_error:
subd_send_msg(ld->connectd, subd_send_msg(ld->connectd,
take(towire_connectd_peer_final_msg(NULL, &peer->id, take(towire_connectd_peer_final_msg(NULL, &peer->id,
error))); error)));
subd_send_fd(ld->connectd, payload->pps->peer_fd); subd_send_fd(ld->connectd, payload->peer_fd->fd);
subd_send_fd(ld->connectd, payload->pps->gossip_fd); subd_send_fd(ld->connectd, payload->peer_fd->gossip_fd);
/* Don't close those fds! */ /* Don't close those fds! */
payload->pps->peer_fd payload->peer_fd->fd = payload->peer_fd->gossip_fd = -1;
= payload->pps->gossip_fd
= -1;
} }
static bool static bool
@@ -1132,8 +1130,7 @@ void peer_connected(struct lightningd *ld, const u8 *msg,
fatal("Connectd gave bad CONNECT_PEER_CONNECTED message %s", fatal("Connectd gave bad CONNECT_PEER_CONNECTED message %s",
tal_hex(msg, msg)); tal_hex(msg, msg));
hook_payload->pps = new_per_peer_state(hook_payload); hook_payload->peer_fd = new_peer_fd(hook_payload, peer_fd, gossip_fd);
per_peer_state_set_fds(hook_payload->pps, peer_fd, gossip_fd);
/* If we're already dealing with this peer, hand off to correct /* If we're already dealing with this peer, hand off to correct
* subdaemon. Otherwise, we'll hand to openingd to wait there. */ * subdaemon. Otherwise, we'll hand to openingd to wait there. */

View File

@@ -11,7 +11,7 @@
#include <common/wireaddr.h> #include <common/wireaddr.h>
#include <wallet/wallet.h> #include <wallet/wallet.h>
struct per_peer_state; struct peer_fd;
struct wally_psbt; struct wally_psbt;
struct peer { struct peer {
@@ -71,7 +71,7 @@ void peer_connected(struct lightningd *ld, const u8 *msg,
#define OUR_CHANNEL_FLAGS CHANNEL_FLAGS_ANNOUNCE_CHANNEL #define OUR_CHANNEL_FLAGS CHANNEL_FLAGS_ANNOUNCE_CHANNEL
void channel_errmsg(struct channel *channel, void channel_errmsg(struct channel *channel,
struct per_peer_state *pps, struct peer_fd *peer_fd,
const struct channel_id *channel_id, const struct channel_id *channel_id,
const char *desc, const char *desc,
bool warning, bool warning,

29
lightningd/peer_fd.c Normal file
View File

@@ -0,0 +1,29 @@
#include "config.h"
#include <assert.h>
#include <lightningd/peer_fd.h>
#include <unistd.h>
static void destroy_peer_fd(struct peer_fd *peer_fd)
{
if (peer_fd->fd != -1)
close(peer_fd->fd);
if (peer_fd->gossip_fd != -1)
close(peer_fd->gossip_fd);
}
struct peer_fd *new_peer_fd(const tal_t *ctx, int peer_fdnum, int gossip_fd)
{
struct peer_fd *peer_fd = tal(ctx, struct peer_fd);
peer_fd->fd = peer_fdnum;
peer_fd->gossip_fd = gossip_fd;
tal_add_destructor(peer_fd, destroy_peer_fd);
return peer_fd;
}
struct peer_fd *new_peer_fd_arr(const tal_t *ctx, const int *fds)
{
/* We expect 2 fds. */
assert(tal_count(fds) == 2);
return new_peer_fd(ctx, fds[0], fds[1]);
}

21
lightningd/peer_fd.h Normal file
View File

@@ -0,0 +1,21 @@
#ifndef LIGHTNING_LIGHTNINGD_PEER_FD_H
#define LIGHTNING_LIGHTNINGD_PEER_FD_H
#include "config.h"
#include <ccan/tal/tal.h>
/* This name is a little preemptive: it still contains the gossip_fd
* for now! */
struct peer_fd {
/* If not -1, closed on freeing */
int fd;
int gossip_fd;
};
/* Allocate a new per-peer state and add destructor to close fds if set;
* sets fds to -1. */
struct peer_fd *new_peer_fd(const tal_t *ctx, int peer_fd, int gossip_fd);
/* Array version of above: tal_count(fds) must be 2 */
struct peer_fd *new_peer_fd_arr(const tal_t *ctx, const int *fds);
#endif /* LIGHTNING_LIGHTNINGD_PEER_FD_H */

View File

@@ -14,6 +14,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <lightningd/lightningd.h> #include <lightningd/lightningd.h>
#include <lightningd/log_status.h> #include <lightningd/log_status.h>
#include <lightningd/peer_fd.h>
#include <lightningd/subd.h> #include <lightningd/subd.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/wait.h> #include <sys/wait.h>
@@ -409,7 +410,7 @@ static bool handle_peer_error(struct subd *sd, const u8 *msg, int fds[2])
void *channel = sd->channel; void *channel = sd->channel;
struct channel_id channel_id; struct channel_id channel_id;
char *desc; char *desc;
struct per_peer_state *pps; struct peer_fd *peer_fd;
u8 *err_for_them; u8 *err_for_them;
bool warning; bool warning;
@@ -418,12 +419,11 @@ static bool handle_peer_error(struct subd *sd, const u8 *msg, int fds[2])
&err_for_them)) &err_for_them))
return false; return false;
pps = new_per_peer_state(msg); peer_fd = new_peer_fd_arr(msg, fds);
per_peer_state_set_fds_arr(pps, fds);
/* Don't free sd; we may be about to free channel. */ /* Don't free sd; we may be about to free channel. */
sd->channel = NULL; sd->channel = NULL;
sd->errcb(channel, pps, &channel_id, desc, warning, err_for_them); sd->errcb(channel, peer_fd, &channel_id, desc, warning, err_for_them);
return true; return true;
} }
@@ -682,7 +682,7 @@ static struct subd *new_subd(struct lightningd *ld,
unsigned int (*msgcb)(struct subd *, unsigned int (*msgcb)(struct subd *,
const u8 *, const int *fds), const u8 *, const int *fds),
void (*errcb)(void *channel, void (*errcb)(void *channel,
struct per_peer_state *pps, struct peer_fd *peer_fd,
const struct channel_id *channel_id, const struct channel_id *channel_id,
const char *desc, const char *desc,
bool warning, bool warning,
@@ -789,7 +789,7 @@ struct subd *new_channel_subd_(struct lightningd *ld,
unsigned int (*msgcb)(struct subd *, const u8 *, unsigned int (*msgcb)(struct subd *, const u8 *,
const int *fds), const int *fds),
void (*errcb)(void *channel, void (*errcb)(void *channel,
struct per_peer_state *pps, struct peer_fd *peer_fd,
const struct channel_id *channel_id, const struct channel_id *channel_id,
const char *desc, const char *desc,
bool warning, bool warning,

View File

@@ -11,7 +11,7 @@
struct crypto_state; struct crypto_state;
struct io_conn; struct io_conn;
struct per_peer_state; struct peer_fd;
/* By convention, replies are requests + 100 */ /* By convention, replies are requests + 100 */
#define SUBD_REPLY_OFFSET 100 #define SUBD_REPLY_OFFSET 100
@@ -43,11 +43,11 @@ struct subd {
unsigned (*msgcb)(struct subd *, const u8 *, const int *); unsigned (*msgcb)(struct subd *, const u8 *, const int *);
const char *(*msgname)(int msgtype); const char *(*msgname)(int msgtype);
/* If per_peer_state == NULL, it was a disconnect/crash. Otherwise, /* If peer_fd == NULL, it was a disconnect/crash. Otherwise,
* sufficient information to hand back to gossipd, including the * sufficient information to hand back to gossipd, including the
* error message we sent them if any. */ * error message we sent them if any. */
void (*errcb)(void *channel, void (*errcb)(void *channel,
struct per_peer_state *pps, struct peer_fd *peer_fd,
const struct channel_id *channel_id, const struct channel_id *channel_id,
const char *desc, const char *desc,
bool warning, bool warning,
@@ -124,7 +124,7 @@ struct subd *new_channel_subd_(struct lightningd *ld,
unsigned int (*msgcb)(struct subd *, const u8 *, unsigned int (*msgcb)(struct subd *, const u8 *,
const int *fds), const int *fds),
void (*errcb)(void *channel, void (*errcb)(void *channel,
struct per_peer_state *pps, struct peer_fd *peer_fd,
const struct channel_id *channel_id, const struct channel_id *channel_id,
const char *desc, const char *desc,
bool warning, bool warning,
@@ -141,7 +141,7 @@ struct subd *new_channel_subd_(struct lightningd *ld,
(msgname), (msgcb), \ (msgname), (msgcb), \
typesafe_cb_postargs(void, void *, (errcb), \ typesafe_cb_postargs(void, void *, (errcb), \
(channel), \ (channel), \
struct per_peer_state *, \ struct peer_fd *, \
const struct channel_id *, \ const struct channel_id *, \
const char *, bool, const u8 *), \ const char *, bool, const u8 *), \
typesafe_cb_postargs(void, void *, (billboardcb), \ typesafe_cb_postargs(void, void *, (billboardcb), \

View File

@@ -167,18 +167,15 @@ struct log *new_log(const tal_t *ctx UNNEEDED, struct log_book *record UNNEEDED,
/* Generated stub for new_log_book */ /* Generated stub for new_log_book */
struct log_book *new_log_book(struct lightningd *ld UNNEEDED, size_t max_mem UNNEEDED) struct log_book *new_log_book(struct lightningd *ld UNNEEDED, size_t max_mem UNNEEDED)
{ fprintf(stderr, "new_log_book called!\n"); abort(); } { fprintf(stderr, "new_log_book called!\n"); abort(); }
/* Generated stub for new_per_peer_state */ /* Generated stub for new_peer_fd_arr */
struct per_peer_state *new_per_peer_state(const tal_t *ctx UNNEEDED) struct peer_fd *new_peer_fd_arr(const tal_t *ctx UNNEEDED, const int *fds UNNEEDED)
{ fprintf(stderr, "new_per_peer_state called!\n"); abort(); } { fprintf(stderr, "new_peer_fd_arr called!\n"); abort(); }
/* Generated stub for new_topology */ /* Generated stub for new_topology */
struct chain_topology *new_topology(struct lightningd *ld UNNEEDED, struct log *log UNNEEDED) struct chain_topology *new_topology(struct lightningd *ld UNNEEDED, struct log *log UNNEEDED)
{ fprintf(stderr, "new_topology called!\n"); abort(); } { fprintf(stderr, "new_topology called!\n"); abort(); }
/* Generated stub for onchaind_replay_channels */ /* Generated stub for onchaind_replay_channels */
void onchaind_replay_channels(struct lightningd *ld UNNEEDED) void onchaind_replay_channels(struct lightningd *ld UNNEEDED)
{ fprintf(stderr, "onchaind_replay_channels called!\n"); abort(); } { fprintf(stderr, "onchaind_replay_channels called!\n"); abort(); }
/* Generated stub for per_peer_state_set_fds_arr */
void per_peer_state_set_fds_arr(struct per_peer_state *pps UNNEEDED, const int *fds UNNEEDED)
{ fprintf(stderr, "per_peer_state_set_fds_arr called!\n"); abort(); }
/* Generated stub for plugins_config */ /* Generated stub for plugins_config */
void plugins_config(struct plugins *plugins UNNEEDED) void plugins_config(struct plugins *plugins UNNEEDED)
{ fprintf(stderr, "plugins_config called!\n"); abort(); } { fprintf(stderr, "plugins_config called!\n"); abort(); }

View File

@@ -444,9 +444,9 @@ struct height_states *new_height_states(const tal_t *ctx UNNEEDED,
enum side opener UNNEEDED, enum side opener UNNEEDED,
const u32 *blockheight UNNEEDED) const u32 *blockheight UNNEEDED)
{ fprintf(stderr, "new_height_states called!\n"); abort(); } { fprintf(stderr, "new_height_states called!\n"); abort(); }
/* Generated stub for new_per_peer_state */ /* Generated stub for new_peer_fd */
struct per_peer_state *new_per_peer_state(const tal_t *ctx UNNEEDED) struct peer_fd *new_peer_fd(const tal_t *ctx UNNEEDED, int peer_fd UNNEEDED, int gossip_fd UNNEEDED)
{ fprintf(stderr, "new_per_peer_state called!\n"); abort(); } { fprintf(stderr, "new_peer_fd called!\n"); abort(); }
/* Generated stub for new_reltimer_ */ /* Generated stub for new_reltimer_ */
struct oneshot *new_reltimer_(struct timers *timers UNNEEDED, struct oneshot *new_reltimer_(struct timers *timers UNNEEDED,
const tal_t *ctx UNNEEDED, const tal_t *ctx UNNEEDED,
@@ -579,30 +579,26 @@ struct channel *peer_normal_channel(struct peer *peer UNNEEDED)
{ fprintf(stderr, "peer_normal_channel called!\n"); abort(); } { fprintf(stderr, "peer_normal_channel called!\n"); abort(); }
/* Generated stub for peer_restart_dualopend */ /* Generated stub for peer_restart_dualopend */
void peer_restart_dualopend(struct peer *peer UNNEEDED, void peer_restart_dualopend(struct peer *peer UNNEEDED,
struct per_peer_state *pps UNNEEDED, struct peer_fd *peer_fd UNNEEDED,
struct channel *channel UNNEEDED) struct channel *channel UNNEEDED)
{ fprintf(stderr, "peer_restart_dualopend called!\n"); abort(); } { fprintf(stderr, "peer_restart_dualopend called!\n"); abort(); }
/* Generated stub for peer_start_channeld */ /* Generated stub for peer_start_channeld */
void peer_start_channeld(struct channel *channel UNNEEDED, void peer_start_channeld(struct channel *channel UNNEEDED,
struct per_peer_state *pps UNNEEDED, struct peer_fd *peer_fd UNNEEDED,
const u8 *fwd_msg UNNEEDED, const u8 *fwd_msg UNNEEDED,
bool reconnected UNNEEDED, bool reconnected UNNEEDED,
const u8 *reestablish_only UNNEEDED) const u8 *reestablish_only UNNEEDED)
{ fprintf(stderr, "peer_start_channeld called!\n"); abort(); } { fprintf(stderr, "peer_start_channeld called!\n"); abort(); }
/* Generated stub for peer_start_dualopend */ /* Generated stub for peer_start_dualopend */
void peer_start_dualopend(struct peer *peer UNNEEDED, struct per_peer_state *pps UNNEEDED) void peer_start_dualopend(struct peer *peer UNNEEDED, struct peer_fd *peer_fd UNNEEDED)
{ fprintf(stderr, "peer_start_dualopend called!\n"); abort(); } { fprintf(stderr, "peer_start_dualopend called!\n"); abort(); }
/* Generated stub for peer_start_openingd */ /* Generated stub for peer_start_openingd */
void peer_start_openingd(struct peer *peer UNNEEDED, void peer_start_openingd(struct peer *peer UNNEEDED,
struct per_peer_state *pps UNNEEDED) struct peer_fd *peer_fd UNNEEDED)
{ fprintf(stderr, "peer_start_openingd called!\n"); abort(); } { fprintf(stderr, "peer_start_openingd called!\n"); abort(); }
/* Generated stub for peer_unsaved_channel */ /* Generated stub for peer_unsaved_channel */
struct channel *peer_unsaved_channel(struct peer *peer UNNEEDED) struct channel *peer_unsaved_channel(struct peer *peer UNNEEDED)
{ fprintf(stderr, "peer_unsaved_channel called!\n"); abort(); } { fprintf(stderr, "peer_unsaved_channel called!\n"); abort(); }
/* Generated stub for per_peer_state_set_fds */
void per_peer_state_set_fds(struct per_peer_state *pps UNNEEDED,
int peer_fd UNNEEDED, int gossip_fd UNNEEDED)
{ fprintf(stderr, "per_peer_state_set_fds called!\n"); abort(); }
/* Generated stub for plugin_hook_call_ */ /* Generated stub for plugin_hook_call_ */
bool plugin_hook_call_(struct lightningd *ld UNNEEDED, const struct plugin_hook *hook UNNEEDED, bool plugin_hook_call_(struct lightningd *ld UNNEEDED, const struct plugin_hook *hook UNNEEDED,
tal_t *cb_arg STEALS UNNEEDED) tal_t *cb_arg STEALS UNNEEDED)

View File

@@ -108,12 +108,9 @@ struct log *new_log(const tal_t *ctx UNNEEDED, struct log_book *record UNNEEDED,
const struct node_id *default_node_id UNNEEDED, const struct node_id *default_node_id UNNEEDED,
const char *fmt UNNEEDED, ...) const char *fmt UNNEEDED, ...)
{ fprintf(stderr, "new_log called!\n"); abort(); } { fprintf(stderr, "new_log called!\n"); abort(); }
/* Generated stub for new_per_peer_state */ /* Generated stub for new_peer_fd_arr */
struct per_peer_state *new_per_peer_state(const tal_t *ctx UNNEEDED) struct peer_fd *new_peer_fd_arr(const tal_t *ctx UNNEEDED, const int *fds UNNEEDED)
{ fprintf(stderr, "new_per_peer_state called!\n"); abort(); } { fprintf(stderr, "new_peer_fd_arr called!\n"); abort(); }
/* Generated stub for per_peer_state_set_fds_arr */
void per_peer_state_set_fds_arr(struct per_peer_state *pps UNNEEDED, const int *fds UNNEEDED)
{ fprintf(stderr, "per_peer_state_set_fds_arr called!\n"); abort(); }
/* Generated stub for subdaemon_path */ /* Generated stub for subdaemon_path */
const char *subdaemon_path(const tal_t *ctx UNNEEDED, const struct lightningd *ld UNNEEDED, const char *name UNNEEDED) const char *subdaemon_path(const tal_t *ctx UNNEEDED, const struct lightningd *ld UNNEEDED, const char *name UNNEEDED)
{ fprintf(stderr, "subdaemon_path called!\n"); abort(); } { fprintf(stderr, "subdaemon_path called!\n"); abort(); }

View File

@@ -448,9 +448,9 @@ struct chain_coin_mvt *new_coin_wallet_deposit(const tal_t *ctx UNNEEDED,
enum mvt_tag tag) enum mvt_tag tag)
{ fprintf(stderr, "new_coin_wallet_deposit called!\n"); abort(); } { fprintf(stderr, "new_coin_wallet_deposit called!\n"); abort(); }
/* Generated stub for new_per_peer_state */ /* Generated stub for new_peer_fd */
struct per_peer_state *new_per_peer_state(const tal_t *ctx UNNEEDED) struct peer_fd *new_peer_fd(const tal_t *ctx UNNEEDED, int peer_fd UNNEEDED, int gossip_fd UNNEEDED)
{ fprintf(stderr, "new_per_peer_state called!\n"); abort(); } { fprintf(stderr, "new_peer_fd called!\n"); abort(); }
/* Generated stub for notify_chain_mvt */ /* Generated stub for notify_chain_mvt */
void notify_chain_mvt(struct lightningd *ld UNNEEDED, const struct chain_coin_mvt *mvt UNNEEDED) void notify_chain_mvt(struct lightningd *ld UNNEEDED, const struct chain_coin_mvt *mvt UNNEEDED)
{ fprintf(stderr, "notify_chain_mvt called!\n"); abort(); } { fprintf(stderr, "notify_chain_mvt called!\n"); abort(); }
@@ -606,22 +606,22 @@ void peer_memleak_done(struct command *cmd UNNEEDED, struct subd *leaker UNNEEDE
{ fprintf(stderr, "peer_memleak_done called!\n"); abort(); } { fprintf(stderr, "peer_memleak_done called!\n"); abort(); }
/* Generated stub for peer_restart_dualopend */ /* Generated stub for peer_restart_dualopend */
void peer_restart_dualopend(struct peer *peer UNNEEDED, void peer_restart_dualopend(struct peer *peer UNNEEDED,
struct per_peer_state *pps UNNEEDED, struct peer_fd *peer_fd UNNEEDED,
struct channel *channel UNNEEDED) struct channel *channel UNNEEDED)
{ fprintf(stderr, "peer_restart_dualopend called!\n"); abort(); } { fprintf(stderr, "peer_restart_dualopend called!\n"); abort(); }
/* Generated stub for peer_start_channeld */ /* Generated stub for peer_start_channeld */
void peer_start_channeld(struct channel *channel UNNEEDED, void peer_start_channeld(struct channel *channel UNNEEDED,
struct per_peer_state *pps UNNEEDED, struct peer_fd *peer_fd UNNEEDED,
const u8 *fwd_msg UNNEEDED, const u8 *fwd_msg UNNEEDED,
bool reconnected UNNEEDED, bool reconnected UNNEEDED,
const u8 *reestablish_only UNNEEDED) const u8 *reestablish_only UNNEEDED)
{ fprintf(stderr, "peer_start_channeld called!\n"); abort(); } { fprintf(stderr, "peer_start_channeld called!\n"); abort(); }
/* Generated stub for peer_start_dualopend */ /* Generated stub for peer_start_dualopend */
void peer_start_dualopend(struct peer *peer UNNEEDED, struct per_peer_state *pps UNNEEDED) void peer_start_dualopend(struct peer *peer UNNEEDED, struct peer_fd *peer_fd UNNEEDED)
{ fprintf(stderr, "peer_start_dualopend called!\n"); abort(); } { fprintf(stderr, "peer_start_dualopend called!\n"); abort(); }
/* Generated stub for peer_start_openingd */ /* Generated stub for peer_start_openingd */
void peer_start_openingd(struct peer *peer UNNEEDED, void peer_start_openingd(struct peer *peer UNNEEDED,
struct per_peer_state *pps UNNEEDED) struct peer_fd *peer_fd UNNEEDED)
{ fprintf(stderr, "peer_start_openingd called!\n"); abort(); } { fprintf(stderr, "peer_start_openingd called!\n"); abort(); }
/* Generated stub for peer_wire_is_defined */ /* Generated stub for peer_wire_is_defined */
bool peer_wire_is_defined(u16 type UNNEEDED) bool peer_wire_is_defined(u16 type UNNEEDED)
@@ -629,10 +629,6 @@ bool peer_wire_is_defined(u16 type UNNEEDED)
/* Generated stub for peer_wire_name */ /* Generated stub for peer_wire_name */
const char *peer_wire_name(int e UNNEEDED) const char *peer_wire_name(int e UNNEEDED)
{ fprintf(stderr, "peer_wire_name called!\n"); abort(); } { fprintf(stderr, "peer_wire_name called!\n"); abort(); }
/* Generated stub for per_peer_state_set_fds */
void per_peer_state_set_fds(struct per_peer_state *pps UNNEEDED,
int peer_fd UNNEEDED, int gossip_fd UNNEEDED)
{ fprintf(stderr, "per_peer_state_set_fds called!\n"); abort(); }
/* Generated stub for plugin_hook_call_ */ /* Generated stub for plugin_hook_call_ */
bool plugin_hook_call_(struct lightningd *ld UNNEEDED, const struct plugin_hook *hook UNNEEDED, bool plugin_hook_call_(struct lightningd *ld UNNEEDED, const struct plugin_hook *hook UNNEEDED,
tal_t *cb_arg STEALS UNNEEDED) tal_t *cb_arg STEALS UNNEEDED)