common: disallow NULL channel_id to peer_failed_err.

No more sending "all-channel" errors; in particular, gossipd now only
sends warnings (which make us hang up), not errors, and peer_connected
rejections are warnings (and disconnect), not errors.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: Plugins: `peer_connected` rejections now send a warning, not an error, to the peer.
This commit is contained in:
Rusty Russell
2021-02-03 13:21:41 +10:30
parent f4ee41a989
commit 6b11cc8b8c
25 changed files with 220 additions and 216 deletions

View File

@@ -1083,9 +1083,9 @@ peer_connected_hook_deserialize(struct peer_connected_hook_payload *payload,
if (json_tok_streq(buffer, t_res, "disconnect")) {
payload->error = (u8*)"";
if (t_err) {
payload->error = towire_errorfmt(tmpctx, NULL, "%.*s",
t_err->end - t_err->start,
buffer + t_err->start);
payload->error = towire_warningfmt(tmpctx, NULL, "%.*s",
t_err->end - t_err->start,
buffer + t_err->start);
}
log_debug(ld->log, "peer_connected hook rejects and says '%s'",
payload->error);
@@ -2238,7 +2238,8 @@ static void process_dev_forget_channel(struct bitcoind *bitcoind UNUSED,
json_add_txid(response, "funding_txid", &forget->channel->funding_txid);
/* Set error so we don't try to reconnect. */
forget->channel->error = towire_errorfmt(forget->channel, NULL,
forget->channel->error = towire_errorfmt(forget->channel,
&forget->channel->cid,
"dev_forget_channel");
delete_channel(forget->channel);