lightningd: always use BROKEN log level if we can't spawn a daemon.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2020-03-25 14:56:44 +10:30 committed by Christian Decker
parent 3e311b2510
commit e1ba42f139
3 changed files with 15 additions and 11 deletions

View File

@ -401,8 +401,8 @@ void peer_start_channeld(struct channel *channel,
take(&hsmfd), NULL));
if (!channel->owner) {
log_unusual(channel->log, "Could not subdaemon channel: %s",
strerror(errno));
log_broken(channel->log, "Could not subdaemon channel: %s",
strerror(errno));
channel_fail_reconnect_later(channel,
"Failed to subdaemon channel");
return;

View File

@ -202,7 +202,7 @@ void peer_start_closingd(struct channel *channel,
NULL));
if (!channel->owner) {
log_unusual(channel->log, "Could not subdaemon closing: %s",
log_broken(channel->log, "Could not subdaemon closing: %s",
strerror(errno));
channel_fail_reconnect_later(channel,
"Failed to subdaemon closing");

View File

@ -99,10 +99,11 @@ struct funding_channel {
};
static void uncommitted_channel_disconnect(struct uncommitted_channel *uc,
enum log_level level,
const char *desc)
{
u8 *msg = towire_connectctl_peer_disconnected(tmpctx, &uc->peer->id);
log_info(uc->log, "%s", desc);
log_(uc->log, level, NULL, false, "%s", desc);
subd_send_msg(uc->peer->ld->connectd, msg);
if (uc->fc && uc->fc->cmd)
was_pending(command_fail(uc->fc->cmd, LIGHTNINGD, "%s", desc));
@ -118,7 +119,7 @@ void kill_uncommitted_channel(struct uncommitted_channel *uc,
subd_release_channel(uc->openingd, uc);
uc->openingd = NULL;
uncommitted_channel_disconnect(uc, why);
uncommitted_channel_disconnect(uc, LOG_INFORM, why);
tal_free(uc);
}
@ -485,7 +486,8 @@ static void opening_fundee_finished(struct subd *openingd,
&remote_upfront_shutdown_script)) {
log_broken(uc->log, "bad OPENING_FUNDEE_REPLY %s",
tal_hex(reply, reply));
uncommitted_channel_disconnect(uc, "bad OPENING_FUNDEE_REPLY");
uncommitted_channel_disconnect(uc, LOG_BROKEN,
"bad OPENING_FUNDEE_REPLY");
goto failed;
}
@ -494,8 +496,9 @@ static void opening_fundee_finished(struct subd *openingd,
/* openingd should never accept them funding channel in this case. */
if (peer_active_channel(uc->peer)) {
log_broken(uc->log, "openingd accepted peer funding channel");
uncommitted_channel_disconnect(uc, "already have active channel");
uncommitted_channel_disconnect(uc,
LOG_BROKEN,
"already have active channel");
goto failed;
}
@ -513,7 +516,8 @@ static void opening_fundee_finished(struct subd *openingd,
local_upfront_shutdown_script,
remote_upfront_shutdown_script);
if (!channel) {
uncommitted_channel_disconnect(uc, "Commit channel failed");
uncommitted_channel_disconnect(uc, LOG_BROKEN,
"Commit channel failed");
goto failed;
}
@ -585,7 +589,7 @@ static void opening_channel_errmsg(struct uncommitted_channel *uc,
{
/* Close fds, if any. */
tal_free(pps);
uncommitted_channel_disconnect(uc, desc);
uncommitted_channel_disconnect(uc, LOG_INFORM, desc);
tal_free(uc);
}
@ -973,7 +977,7 @@ void peer_start_openingd(struct peer *peer,
take(&pps->gossip_store_fd),
take(&hsmfd), NULL);
if (!uc->openingd) {
uncommitted_channel_disconnect(uc,
uncommitted_channel_disconnect(uc, LOG_BROKEN,
tal_fmt(tmpctx,
"Running lightning_openingd: %s",
strerror(errno)));