closingd: add notifications for feerate ranges.

This allows cmdline users to have more idea what's going on.

Inspired-by: https://github.com/ElementsProject/lightning/issues/4777
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: `close` now notifies about the feeranges each side uses.
This commit is contained in:
Rusty Russell
2021-09-15 10:30:14 +09:30
committed by Christian Decker
parent 789b330338
commit d970cc070e
6 changed files with 116 additions and 5 deletions

View File

@@ -283,6 +283,25 @@ static void peer_closing_complete(struct channel *channel, const u8 *msg)
"Closing complete");
}
static void peer_closing_notify(struct channel *channel, const u8 *msg)
{
char *message;
struct close_command *i;
enum log_level level;
if (!fromwire_closingd_notification(msg, msg, &level, &message)) {
channel_internal_error(channel, "Bad closing_notify %s",
tal_hex(msg, msg));
return;
}
list_for_each(&channel->peer->ld->close_commands, i, list) {
if (i->channel != channel)
continue;
json_notify_fmt(i->cmd, level, "%s", message);
}
}
static unsigned closing_msg(struct subd *sd, const u8 *msg, const int *fds UNUSED)
{
enum closingd_wire t = fromwire_peektype(msg);
@@ -296,6 +315,10 @@ static unsigned closing_msg(struct subd *sd, const u8 *msg, const int *fds UNUSE
peer_closing_complete(sd->channel, msg);
break;
case WIRE_CLOSINGD_NOTIFICATION:
peer_closing_notify(sd->channel, msg);
break;
/* We send these, not receive them */
case WIRE_CLOSINGD_INIT:
case WIRE_CLOSINGD_RECEIVED_SIGNATURE_REPLY: