diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index 83e2abf1a..f5c881868 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -3677,9 +3677,9 @@ AUTODATA(json_command, &openchannel_abort_command); static void dualopen_errmsg(struct channel *channel, struct peer_fd *peer_fd, const char *desc, - bool warning, - bool aborted, - const u8 *err_for_them) + const u8 *err_for_them, + bool disconnect, + bool warning) { /* Clean up any in-progress open attempts */ channel_cleanup_commands(channel, desc); @@ -3694,7 +3694,7 @@ static void dualopen_errmsg(struct channel *channel, /* No peer_fd means a subd crash or disconnection. */ if (!peer_fd) { /* If the channel is unsaved, we forget it */ - channel_fail_transient(channel, true, "%s: %s", + channel_fail_transient(channel, disconnect, "%s: %s", channel->owner->name, desc); return; } @@ -3707,14 +3707,14 @@ static void dualopen_errmsg(struct channel *channel, * surprisingly, they now spew out spurious errors frequently, * and we would close the channel on them. We now support warnings * for this case. */ - if (warning || aborted) { + if (warning || !disconnect) { /* We *don't* hang up if they aborted: that's fine! */ - channel_fail_transient(channel, !aborted, "%s %s: %s", + channel_fail_transient(channel, disconnect, "%s %s: %s", channel->owner->name, warning ? "WARNING" : "ABORTED", desc); - if (aborted) { + if (!disconnect) { char *err = restart_dualopend(tmpctx, channel->peer->ld, channel, true); diff --git a/lightningd/onchain_control.c b/lightningd/onchain_control.c index 252c98427..448b9498e 100644 --- a/lightningd/onchain_control.c +++ b/lightningd/onchain_control.c @@ -1496,9 +1496,9 @@ static unsigned int onchain_msg(struct subd *sd, const u8 *msg, const int *fds U static void onchain_error(struct channel *channel, struct peer_fd *pps UNUSED, const char *desc, - bool warning UNUSED, - bool aborted UNUSED, - const u8 *err_for_them UNUSED) + const u8 *err_for_them UNUSED, + bool disconnect UNUSED, + bool warning UNUSED) { channel_set_owner(channel, NULL); diff --git a/lightningd/opening_common.c b/lightningd/opening_common.c index 2ca2e6ac6..d9a4d92ba 100644 --- a/lightningd/opening_common.c +++ b/lightningd/opening_common.c @@ -94,9 +94,9 @@ new_uncommitted_channel(struct peer *peer) void opend_channel_errmsg(struct uncommitted_channel *uc, struct peer_fd *peer_fd, const char *desc, - bool warning UNUSED, - bool aborted UNUSED, - const u8 *err_for_them UNUSED) + const u8 *err_for_them UNUSED, + bool disconnect UNUSED, + bool warning UNUSED) { /* Close fds, if any. */ tal_free(peer_fd); diff --git a/lightningd/opening_common.h b/lightningd/opening_common.h index f46848b98..8b75b56a0 100644 --- a/lightningd/opening_common.h +++ b/lightningd/opening_common.h @@ -110,9 +110,9 @@ struct uncommitted_channel *new_uncommitted_channel(struct peer *peer); void opend_channel_errmsg(struct uncommitted_channel *uc, struct peer_fd *peer_fd, const char *desc, - bool warning UNUSED, - bool aborted UNUSED, - const u8 *err_for_them UNUSED); + const u8 *err_for_them UNUSED, + bool disconnect UNUSED, + bool warning UNUSED); void opend_channel_set_billboard(struct uncommitted_channel *uc, bool perm UNUSED, diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 2774a570a..f115ae35e 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -441,9 +441,9 @@ void resend_closing_transactions(struct lightningd *ld) void channel_errmsg(struct channel *channel, struct peer_fd *peer_fd, const char *desc, - bool warning, - bool aborted UNUSED, - const u8 *err_for_them) + const u8 *err_for_them, + bool disconnect, + bool warning) { /* Clean up any in-progress open attempts */ channel_cleanup_commands(channel, desc); @@ -458,7 +458,7 @@ void channel_errmsg(struct channel *channel, /* No peer_fd means a subd crash or disconnection. */ if (!peer_fd) { /* If the channel is unsaved, we forget it */ - channel_fail_transient(channel, true, "%s: %s", + channel_fail_transient(channel, disconnect, "%s: %s", channel->owner->name, desc); return; } @@ -472,7 +472,7 @@ void channel_errmsg(struct channel *channel, * would recover after a reconnect. So we downgrade, but snark * about it in the logs. */ if (!err_for_them && strends(desc, "internal error")) { - channel_fail_transient(channel, true, "%s: %s", + channel_fail_transient(channel, disconnect, "%s: %s", channel->owner->name, "lnd sent 'internal error':" " let's give it some space"); @@ -481,7 +481,7 @@ void channel_errmsg(struct channel *channel, /* This is us, sending a warning. */ if (warning) { - channel_fail_transient(channel, true, "%s sent %s", + channel_fail_transient(channel, disconnect, "%s sent %s", channel->owner->name, desc); return; diff --git a/lightningd/peer_control.h b/lightningd/peer_control.h index 32d5b2c5a..09d7d466b 100644 --- a/lightningd/peer_control.h +++ b/lightningd/peer_control.h @@ -93,9 +93,9 @@ void peer_spoke(struct lightningd *ld, const u8 *msg); void channel_errmsg(struct channel *channel, struct peer_fd *peer_fd, const char *desc, - bool warning, - bool aborted, - const u8 *err_for_them); + const u8 *err_for_them, + bool disconnect, + bool warning); u8 *p2wpkh_for_keyidx(const tal_t *ctx, struct lightningd *ld, u64 keyidx); u8 *p2tr_for_keyidx(const tal_t *ctx, struct lightningd *ld, u64 keyidx); diff --git a/lightningd/subd.c b/lightningd/subd.c index e48f6cd7f..866edd701 100644 --- a/lightningd/subd.c +++ b/lightningd/subd.c @@ -433,7 +433,7 @@ static bool handle_peer_error(struct subd *sd, const u8 *msg, int fds[1]) /* Don't free sd; we may be about to free channel. */ sd->channel = NULL; - sd->errcb(channel, peer_fd, desc, warning, !disconnect, err_for_them); + sd->errcb(channel, peer_fd, desc, err_for_them, disconnect, warning); return true; } @@ -709,9 +709,9 @@ static struct subd *new_subd(const tal_t *ctx, void (*errcb)(void *channel, struct peer_fd *peer_fd, const char *desc, - bool warning, - bool aborted, - const u8 *err_for_them), + const u8 *err_for_them, + bool disconnect, + bool warning), void (*billboardcb)(void *channel, bool perm, const char *happenings), @@ -815,9 +815,9 @@ struct subd *new_channel_subd_(const tal_t *ctx, void (*errcb)(void *channel, struct peer_fd *peer_fd, const char *desc, - bool warning, - bool aborted, - const u8 *err_for_them), + const u8 *err_for_them, + bool disconnect, + bool warning), void (*billboardcb)(void *channel, bool perm, const char *happenings), ...) diff --git a/lightningd/subd.h b/lightningd/subd.h index 587e86a2e..d59009d23 100644 --- a/lightningd/subd.h +++ b/lightningd/subd.h @@ -52,9 +52,9 @@ struct subd { void (*errcb)(void *channel, struct peer_fd *peer_fd, const char *desc, - bool warning, - bool aborted, - const u8 *err_for_them); + const u8 *err_for_them, + bool disconnect, + bool warning); /* Callback to display information for listpeers RPC */ void (*billboardcb)(void *channel, bool perm, const char *happenings); @@ -134,9 +134,9 @@ struct subd *new_channel_subd_(const tal_t *ctx, void (*errcb)(void *channel, struct peer_fd *peer_fd, const char *desc, - bool warning, - bool aborted, - const u8 *err_for_them), + const u8 *err_for_them, + bool disconnect, + bool warning), void (*billboardcb)(void *channel, bool perm, const char *happenings), ...); @@ -150,7 +150,7 @@ struct subd *new_channel_subd_(const tal_t *ctx, typesafe_cb_postargs(void, void *, (errcb), \ (channel), \ struct peer_fd *, \ - const char *, bool, bool, const u8 *), \ + const char *, const u8 *, bool, bool), \ typesafe_cb_postargs(void, void *, (billboardcb), \ (channel), bool, \ const char *), \