common: add peer_error flag to treat this error as "soft".

The spec says to close the channel if they send us an error, but we
need to be more lenient to preserve channels with other
implementations.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-07-26 11:41:19 +09:30
parent f7a890ca35
commit dd79813a75
10 changed files with 27 additions and 8 deletions

View File

@@ -390,6 +390,7 @@ void channel_errmsg(struct channel *channel,
struct per_peer_state *pps,
const struct channel_id *channel_id UNUSED,
const char *desc,
bool soft_error,
const u8 *err_for_them)
{
notify_disconnect(channel->peer->ld, &channel->peer->id);
@@ -407,6 +408,15 @@ void channel_errmsg(struct channel *channel,
err_for_them,
tal_count(err_for_them), 0);
/* Other implementations chose to ignore errors early on. Not
* surprisingly, they now spew out spurious errors frequently,
* and we would close the channel on them. */
if (soft_error) {
channel_fail_reconnect_later(channel, "%s: (ignoring) %s",
channel->owner->name, desc);
return;
}
/* BOLT #1:
*
* A sending node: