common: don't hang up when we receive a warning.

We were allowed to, but the spec removed that.  So we handle warnings
differently from errors now.

This also means the LND "internal error" workaround is done in
lightningd (we still disconnect, but we don't want to close channel).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: Protocol: we no longer disconnect every time we receive a warning message.
This commit is contained in:
Rusty Russell
2023-09-12 13:53:14 +09:30
parent 1bb83a1ae6
commit 48522f3e9e
16 changed files with 124 additions and 164 deletions

View File

@@ -116,15 +116,14 @@ static struct bitcoin_tx *close_tx(const tal_t *ctx,
/* Handle random messages we might get, returning the first non-handled one. */
static u8 *closing_read_peer_msg(const tal_t *ctx,
struct per_peer_state *pps,
const struct channel_id *channel_id)
struct per_peer_state *pps)
{
for (;;) {
u8 *msg;
clean_tmpctx();
msg = peer_read(ctx, pps);
if (!handle_peer_error(pps, channel_id, msg))
if (!handle_peer_error_or_warning(pps, msg))
return msg;
}
}
@@ -255,7 +254,7 @@ receive_offer(struct per_peer_state *pps,
/* Wait for them to say something interesting */
do {
msg = closing_read_peer_msg(tmpctx, pps, channel_id);
msg = closing_read_peer_msg(tmpctx, pps);
/* BOLT #2:
*