Skip to content

Commit

Permalink
subds: remove "ignore error" from old LND nodes.
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
rustyrussell committed Jan 8, 2022
1 parent 7784909 commit 18edc6f
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 23 deletions.
14 changes: 2 additions & 12 deletions channeld/channeld.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -2905,8 +2898,6 @@ static void peer_reconnect(struct peer *peer,
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! */
Expand All @@ -2922,8 +2913,7 @@ static void peer_reconnect(struct peer *peer,
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:
Expand Down
2 changes: 1 addition & 1 deletion closingd/closingd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
4 changes: 1 addition & 3 deletions common/read_peer_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 0 additions & 2 deletions common/read_peer_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);

/**
Expand Down
6 changes: 2 additions & 4 deletions openingd/dualopend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion openingd/openingd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 18edc6f

Please sign in to comment.