Skip to content

Commit be762d0

Browse files
committed
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 lightning/bolts#932 which suggests you *should* fail when you receive an error. Signed-off-by: Rusty Russell <[email protected]>
1 parent 96ff874 commit be762d0

File tree

6 files changed

+7
-23
lines changed

6 files changed

+7
-23
lines changed

channeld/channeld.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,17 +2231,10 @@ static void peer_in(struct peer *peer, const u8 *msg)
22312231
{
22322232
enum peer_wire type = fromwire_peektype(msg);
22332233

2234-
/* Only count soft errors if the channel has locked-in already;
2235-
* otherwise we can't cancel a channel before it has opened.
2236-
*/
2237-
bool soft_error = peer->funding_locked[REMOTE] || peer->funding_locked[LOCAL];
2238-
22392234
if (channeld_handle_custommsg(msg))
22402235
return;
22412236

2242-
/* Since LND seems to send errors which aren't actually fatal events,
2243-
* we treat errors here as soft. */
2244-
if (handle_peer_gossip_or_error(peer->pps, &peer->channel_id, soft_error, msg))
2237+
if (handle_peer_gossip_or_error(peer->pps, &peer->channel_id, msg))
22452238
return;
22462239

22472240
/* Must get funding_locked before almost anything. */
@@ -2905,8 +2898,6 @@ static void peer_reconnect(struct peer *peer,
29052898
peer_write(peer->pps, take(msg));
29062899

29072900
peer_billboard(false, "Sent reestablish, waiting for theirs");
2908-
bool soft_error = peer->funding_locked[REMOTE]
2909-
|| peer->funding_locked[LOCAL];
29102901

29112902
/* If they sent reestablish, we analyze it for courtesy, but also
29122903
* in case *they* are ahead of us! */
@@ -2922,8 +2913,7 @@ static void peer_reconnect(struct peer *peer,
29222913
clean_tmpctx();
29232914
msg = peer_read(tmpctx, peer->pps);
29242915
} while (channeld_handle_custommsg(msg) ||
2925-
handle_peer_gossip_or_error(peer->pps, &peer->channel_id, soft_error,
2926-
msg) ||
2916+
handle_peer_gossip_or_error(peer->pps, &peer->channel_id, msg) ||
29272917
capture_premature_msg(&premature_msgs, msg));
29282918

29292919
got_reestablish:

closingd/closingd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ static u8 *closing_read_peer_msg(const tal_t *ctx,
136136
wire_sync_write(REQ_FD, take(towire_custommsg_in(NULL, msg)));
137137
continue;
138138
}
139-
if (!handle_peer_gossip_or_error(pps, channel_id, false, msg))
139+
if (!handle_peer_gossip_or_error(pps, channel_id, msg))
140140
return msg;
141141
}
142142
}

common/read_peer_msg.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ void handle_gossip_msg(struct per_peer_state *pps, const u8 *msg TAKES)
112112

113113
bool handle_peer_gossip_or_error(struct per_peer_state *pps,
114114
const struct channel_id *channel_id,
115-
bool soft_error,
116115
const u8 *msg TAKES)
117116
{
118117
char *err;
@@ -150,8 +149,7 @@ bool handle_peer_gossip_or_error(struct per_peer_state *pps,
150149
goto handled;
151150

152151
/* We hang up when a warning is received. */
153-
peer_failed_received_errmsg(pps, err, channel_id,
154-
soft_error || warning);
152+
peer_failed_received_errmsg(pps, err, channel_id, warning);
155153

156154
goto handled;
157155
}

common/read_peer_msg.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ bool is_wrong_channel(const u8 *msg, const struct channel_id *expected,
5858
* handle_peer_gossip_or_error - simple handler for all the above cases.
5959
* @pps: per-peer state.
6060
* @channel_id: the channel id of the current channel.
61-
* @soft_error: tell lightningd that incoming error is non-fatal.
6261
* @msg: the peer message (only taken if returns true).
6362
*
6463
* 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,
6766
*/
6867
bool handle_peer_gossip_or_error(struct per_peer_state *pps,
6968
const struct channel_id *channel_id,
70-
bool soft_error,
7169
const u8 *msg TAKES);
7270

7371
/**

openingd/dualopend.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3540,8 +3540,6 @@ static void do_reconnect_dance(struct state *state)
35403540
peer_write(state->pps, take(msg));
35413541

35423542
peer_billboard(false, "Sent reestablish, waiting for theirs");
3543-
bool soft_error = state->funding_locked[REMOTE]
3544-
|| state->funding_locked[LOCAL];
35453543

35463544
/* Read until they say something interesting (don't forward
35473545
* gossip *to* them yet: we might try sending channel_update
@@ -3552,7 +3550,7 @@ static void do_reconnect_dance(struct state *state)
35523550
} while (dualopend_handle_custommsg(msg)
35533551
|| handle_peer_gossip_or_error(state->pps,
35543552
&state->channel_id,
3555-
soft_error, msg));
3553+
msg));
35563554

35573555
if (!fromwire_channel_reestablish
35583556
(msg, &cid,
@@ -3768,7 +3766,7 @@ static u8 *handle_peer_in(struct state *state)
37683766

37693767
/* Handles standard cases, and legal unknown ones. */
37703768
if (handle_peer_gossip_or_error(state->pps,
3771-
&state->channel_id, false, msg))
3769+
&state->channel_id, msg))
37723770
return NULL;
37733771

37743772
peer_write(state->pps,

openingd/openingd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,7 @@ static u8 *handle_peer_in(struct state *state)
12721272

12731273
/* Handles standard cases, and legal unknown ones. */
12741274
if (handle_peer_gossip_or_error(state->pps,
1275-
&state->channel_id, false, msg))
1275+
&state->channel_id, msg))
12761276
return NULL;
12771277

12781278
extracted = extract_channel_id(msg, &channel_id);

0 commit comments

Comments
 (0)