mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-06 15:44:21 +01:00
df: add a new 'channel_open_failed' notification
Let plugins know when a channel open has failed. We need to notify accepters now too, so we remove the check on who's funding the channel before sending the 'failed' message from dualopend->master.
This commit is contained in:
committed by
Christian Decker
parent
d4ec052668
commit
2cd95aa806
@@ -1133,13 +1133,16 @@ static void open_failed(struct subd *dualopend, const u8 *msg)
|
||||
log_broken(uc->log,
|
||||
"Bad DUALOPEND_FAILED %s",
|
||||
tal_hex(msg, msg));
|
||||
|
||||
if (uc->fc && uc->fc->cmd)
|
||||
was_pending(command_fail(uc->fc->cmd, LIGHTNINGD, "%s",
|
||||
tal_hex(uc->fc->cmd, msg)));
|
||||
|
||||
notify_channel_open_failed(dualopend->ld, &uc->cid);
|
||||
tal_free(uc);
|
||||
}
|
||||
|
||||
notify_channel_open_failed(dualopend->ld, &uc->cid);
|
||||
opening_failed_cancel_commands(uc, desc);
|
||||
}
|
||||
|
||||
|
||||
@@ -511,3 +511,27 @@ void notify_openchannel_peer_sigs(struct lightningd *ld,
|
||||
jsonrpc_notification_end(n);
|
||||
plugins_notify(ld->plugins, take(n));
|
||||
}
|
||||
|
||||
static void channel_open_failed_serialize(struct json_stream *stream,
|
||||
const struct channel_id *cid)
|
||||
{
|
||||
json_object_start(stream, "channel_open_failed");
|
||||
json_add_channel_id(stream, "channel_id", cid);
|
||||
json_object_end(stream);
|
||||
}
|
||||
|
||||
REGISTER_NOTIFICATION(channel_open_failed,
|
||||
channel_open_failed_serialize);
|
||||
|
||||
void notify_channel_open_failed(struct lightningd *ld,
|
||||
const struct channel_id *cid)
|
||||
{
|
||||
void (*serialize)(struct json_stream *,
|
||||
const struct channel_id *) = channel_open_failed_notification_gen.serialize;
|
||||
|
||||
struct jsonrpc_notification *n =
|
||||
jsonrpc_notification_start(NULL, "channel_open_failed");
|
||||
serialize(n->stream, cid);
|
||||
jsonrpc_notification_end(n);
|
||||
plugins_notify(ld->plugins, take(n));
|
||||
}
|
||||
|
||||
@@ -95,4 +95,7 @@ void notify_coin_mvt(struct lightningd *ld,
|
||||
void notify_openchannel_peer_sigs(struct lightningd *ld,
|
||||
const struct channel_id *cid,
|
||||
const struct wally_psbt *psbt);
|
||||
|
||||
void notify_channel_open_failed(struct lightningd *ld,
|
||||
const struct channel_id *cid);
|
||||
#endif /* LIGHTNING_LIGHTNINGD_NOTIFICATION_H */
|
||||
|
||||
Reference in New Issue
Block a user