From f6847f44f68882d56118bd9a4e7041fb99fd34c1 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 20 Jan 2022 15:25:06 +1030 Subject: [PATCH] subds: remove "ignore error" from old LND nodes. This was put in late 2019, and @t-bast says Eclair doesn't ignore their errors and has had no issues. It also conflicts with https://github.com/lightning/bolts/pull/932 which suggests you *should* fail when you receive an error. Signed-off-by: Rusty Russell --- channeld/channeld.c | 14 ++------------ closingd/closingd.c | 2 +- common/read_peer_msg.c | 4 +--- common/read_peer_msg.h | 2 -- openingd/dualopend.c | 6 ++---- openingd/openingd.c | 2 +- 6 files changed, 7 insertions(+), 23 deletions(-) diff --git a/channeld/channeld.c b/channeld/channeld.c index 980bb1033..a8d0aaaa0 100644 --- a/channeld/channeld.c +++ b/channeld/channeld.c @@ -2231,17 +2231,10 @@ static void peer_in(struct peer *peer, const u8 *msg) { enum peer_wire type = fromwire_peektype(msg); - /* Only count soft errors if the channel has locked-in already; - * otherwise we can't cancel a channel before it has opened. - */ - bool soft_error = peer->funding_locked[REMOTE] || peer->funding_locked[LOCAL]; - if (channeld_handle_custommsg(msg)) return; - /* Since LND seems to send errors which aren't actually fatal events, - * we treat errors here as soft. */ - if (handle_peer_gossip_or_error(peer->pps, &peer->channel_id, soft_error, msg)) + if (handle_peer_gossip_or_error(peer->pps, &peer->channel_id, msg)) return; /* Must get funding_locked before almost anything. */ @@ -2905,8 +2898,6 @@ skip_tlvs: peer_write(peer->pps, take(msg)); peer_billboard(false, "Sent reestablish, waiting for theirs"); - bool soft_error = peer->funding_locked[REMOTE] - || peer->funding_locked[LOCAL]; /* If they sent reestablish, we analyze it for courtesy, but also * in case *they* are ahead of us! */ @@ -2922,8 +2913,7 @@ skip_tlvs: clean_tmpctx(); msg = peer_read(tmpctx, peer->pps); } while (channeld_handle_custommsg(msg) || - handle_peer_gossip_or_error(peer->pps, &peer->channel_id, soft_error, - msg) || + handle_peer_gossip_or_error(peer->pps, &peer->channel_id, msg) || capture_premature_msg(&premature_msgs, msg)); got_reestablish: diff --git a/closingd/closingd.c b/closingd/closingd.c index 9fb74e4ba..19665dd8e 100644 --- a/closingd/closingd.c +++ b/closingd/closingd.c @@ -136,7 +136,7 @@ static u8 *closing_read_peer_msg(const tal_t *ctx, wire_sync_write(REQ_FD, take(towire_custommsg_in(NULL, msg))); continue; } - if (!handle_peer_gossip_or_error(pps, channel_id, false, msg)) + if (!handle_peer_gossip_or_error(pps, channel_id, msg)) return msg; } } diff --git a/common/read_peer_msg.c b/common/read_peer_msg.c index fe841108c..c2f87344c 100644 --- a/common/read_peer_msg.c +++ b/common/read_peer_msg.c @@ -112,7 +112,6 @@ void handle_gossip_msg(struct per_peer_state *pps, const u8 *msg TAKES) bool handle_peer_gossip_or_error(struct per_peer_state *pps, const struct channel_id *channel_id, - bool soft_error, const u8 *msg TAKES) { char *err; @@ -150,8 +149,7 @@ bool handle_peer_gossip_or_error(struct per_peer_state *pps, goto handled; /* We hang up when a warning is received. */ - peer_failed_received_errmsg(pps, err, channel_id, - soft_error || warning); + peer_failed_received_errmsg(pps, err, channel_id, warning); goto handled; } diff --git a/common/read_peer_msg.h b/common/read_peer_msg.h index fbdff761a..a3fecb83f 100644 --- a/common/read_peer_msg.h +++ b/common/read_peer_msg.h @@ -58,7 +58,6 @@ bool is_wrong_channel(const u8 *msg, const struct channel_id *expected, * handle_peer_gossip_or_error - simple handler for all the above cases. * @pps: per-peer state. * @channel_id: the channel id of the current channel. - * @soft_error: tell lightningd that incoming error is non-fatal. * @msg: the peer message (only taken if returns true). * * This returns true if it handled the packet: a gossip packet (forwarded @@ -67,7 +66,6 @@ bool is_wrong_channel(const u8 *msg, const struct channel_id *expected, */ bool handle_peer_gossip_or_error(struct per_peer_state *pps, const struct channel_id *channel_id, - bool soft_error, const u8 *msg TAKES); /** diff --git a/openingd/dualopend.c b/openingd/dualopend.c index 997525a85..28c9a407d 100644 --- a/openingd/dualopend.c +++ b/openingd/dualopend.c @@ -3540,8 +3540,6 @@ static void do_reconnect_dance(struct state *state) peer_write(state->pps, take(msg)); peer_billboard(false, "Sent reestablish, waiting for theirs"); - bool soft_error = state->funding_locked[REMOTE] - || state->funding_locked[LOCAL]; /* Read until they say something interesting (don't forward * gossip *to* them yet: we might try sending channel_update @@ -3552,7 +3550,7 @@ static void do_reconnect_dance(struct state *state) } while (dualopend_handle_custommsg(msg) || handle_peer_gossip_or_error(state->pps, &state->channel_id, - soft_error, msg)); + msg)); if (!fromwire_channel_reestablish (msg, &cid, @@ -3768,7 +3766,7 @@ static u8 *handle_peer_in(struct state *state) /* Handles standard cases, and legal unknown ones. */ if (handle_peer_gossip_or_error(state->pps, - &state->channel_id, false, msg)) + &state->channel_id, msg)) return NULL; peer_write(state->pps, diff --git a/openingd/openingd.c b/openingd/openingd.c index e94c31f74..42257adfb 100644 --- a/openingd/openingd.c +++ b/openingd/openingd.c @@ -1272,7 +1272,7 @@ static u8 *handle_peer_in(struct state *state) /* Handles standard cases, and legal unknown ones. */ if (handle_peer_gossip_or_error(state->pps, - &state->channel_id, false, msg)) + &state->channel_id, msg)) return NULL; extracted = extract_channel_id(msg, &channel_id);