mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
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 <rusty@rustcorp.com.au>
This commit is contained in:
@@ -2231,17 +2231,10 @@ static void peer_in(struct peer *peer, const u8 *msg)
|
|||||||
{
|
{
|
||||||
enum peer_wire type = fromwire_peektype(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))
|
if (channeld_handle_custommsg(msg))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Since LND seems to send errors which aren't actually fatal events,
|
if (handle_peer_gossip_or_error(peer->pps, &peer->channel_id, msg))
|
||||||
* we treat errors here as soft. */
|
|
||||||
if (handle_peer_gossip_or_error(peer->pps, &peer->channel_id, soft_error, msg))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Must get funding_locked before almost anything. */
|
/* Must get funding_locked before almost anything. */
|
||||||
@@ -2905,8 +2898,6 @@ skip_tlvs:
|
|||||||
peer_write(peer->pps, take(msg));
|
peer_write(peer->pps, take(msg));
|
||||||
|
|
||||||
peer_billboard(false, "Sent reestablish, waiting for theirs");
|
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
|
/* If they sent reestablish, we analyze it for courtesy, but also
|
||||||
* in case *they* are ahead of us! */
|
* in case *they* are ahead of us! */
|
||||||
@@ -2922,8 +2913,7 @@ skip_tlvs:
|
|||||||
clean_tmpctx();
|
clean_tmpctx();
|
||||||
msg = peer_read(tmpctx, peer->pps);
|
msg = peer_read(tmpctx, peer->pps);
|
||||||
} while (channeld_handle_custommsg(msg) ||
|
} while (channeld_handle_custommsg(msg) ||
|
||||||
handle_peer_gossip_or_error(peer->pps, &peer->channel_id, soft_error,
|
handle_peer_gossip_or_error(peer->pps, &peer->channel_id, msg) ||
|
||||||
msg) ||
|
|
||||||
capture_premature_msg(&premature_msgs, msg));
|
capture_premature_msg(&premature_msgs, msg));
|
||||||
|
|
||||||
got_reestablish:
|
got_reestablish:
|
||||||
|
|||||||
@@ -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)));
|
wire_sync_write(REQ_FD, take(towire_custommsg_in(NULL, msg)));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!handle_peer_gossip_or_error(pps, channel_id, false, msg))
|
if (!handle_peer_gossip_or_error(pps, channel_id, msg))
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,
|
bool handle_peer_gossip_or_error(struct per_peer_state *pps,
|
||||||
const struct channel_id *channel_id,
|
const struct channel_id *channel_id,
|
||||||
bool soft_error,
|
|
||||||
const u8 *msg TAKES)
|
const u8 *msg TAKES)
|
||||||
{
|
{
|
||||||
char *err;
|
char *err;
|
||||||
@@ -150,8 +149,7 @@ bool handle_peer_gossip_or_error(struct per_peer_state *pps,
|
|||||||
goto handled;
|
goto handled;
|
||||||
|
|
||||||
/* We hang up when a warning is received. */
|
/* We hang up when a warning is received. */
|
||||||
peer_failed_received_errmsg(pps, err, channel_id,
|
peer_failed_received_errmsg(pps, err, channel_id, warning);
|
||||||
soft_error || warning);
|
|
||||||
|
|
||||||
goto handled;
|
goto handled;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
* handle_peer_gossip_or_error - simple handler for all the above cases.
|
||||||
* @pps: per-peer state.
|
* @pps: per-peer state.
|
||||||
* @channel_id: the channel id of the current channel.
|
* @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).
|
* @msg: the peer message (only taken if returns true).
|
||||||
*
|
*
|
||||||
* This returns true if it handled the packet: a gossip packet (forwarded
|
* 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,
|
bool handle_peer_gossip_or_error(struct per_peer_state *pps,
|
||||||
const struct channel_id *channel_id,
|
const struct channel_id *channel_id,
|
||||||
bool soft_error,
|
|
||||||
const u8 *msg TAKES);
|
const u8 *msg TAKES);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3540,8 +3540,6 @@ static void do_reconnect_dance(struct state *state)
|
|||||||
peer_write(state->pps, take(msg));
|
peer_write(state->pps, take(msg));
|
||||||
|
|
||||||
peer_billboard(false, "Sent reestablish, waiting for theirs");
|
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
|
/* Read until they say something interesting (don't forward
|
||||||
* gossip *to* them yet: we might try sending channel_update
|
* 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)
|
} while (dualopend_handle_custommsg(msg)
|
||||||
|| handle_peer_gossip_or_error(state->pps,
|
|| handle_peer_gossip_or_error(state->pps,
|
||||||
&state->channel_id,
|
&state->channel_id,
|
||||||
soft_error, msg));
|
msg));
|
||||||
|
|
||||||
if (!fromwire_channel_reestablish
|
if (!fromwire_channel_reestablish
|
||||||
(msg, &cid,
|
(msg, &cid,
|
||||||
@@ -3768,7 +3766,7 @@ static u8 *handle_peer_in(struct state *state)
|
|||||||
|
|
||||||
/* Handles standard cases, and legal unknown ones. */
|
/* Handles standard cases, and legal unknown ones. */
|
||||||
if (handle_peer_gossip_or_error(state->pps,
|
if (handle_peer_gossip_or_error(state->pps,
|
||||||
&state->channel_id, false, msg))
|
&state->channel_id, msg))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
peer_write(state->pps,
|
peer_write(state->pps,
|
||||||
|
|||||||
@@ -1272,7 +1272,7 @@ static u8 *handle_peer_in(struct state *state)
|
|||||||
|
|
||||||
/* Handles standard cases, and legal unknown ones. */
|
/* Handles standard cases, and legal unknown ones. */
|
||||||
if (handle_peer_gossip_or_error(state->pps,
|
if (handle_peer_gossip_or_error(state->pps,
|
||||||
&state->channel_id, false, msg))
|
&state->channel_id, msg))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
extracted = extract_channel_id(msg, &channel_id);
|
extracted = extract_channel_id(msg, &channel_id);
|
||||||
|
|||||||
Reference in New Issue
Block a user