Open darosior opened 4 years ago
Added a couple of tags as requested :-)
I think this might be a good first issue for new contributors since it can be implemented using existing infrastructure.
I wanted to say that the hook can be used like a notification by returning {"result": "continue"}
, however notifications can be dispatched in parallel, while hooks are called sequentially, so there's definitely a good reason to add the hook as well.
Having the reason for the channel closure somehow would be great (mutual from us, mutual from them, unilateral because of fees, unilateral because of expiring HTLCs, or other reasons).
Hm is channel_closed
notification covered by channel_state_changed
notification with i.e. old_state
== CHANNELD_NORMAL
?
Also htlc_accepted
is already a hook that is chainable (iirc) and thus can be used as a notification
Hm is
channel_closed
notification covered bychannel_state_changed
notification with i.e.old_state
==CHANNELD_NORMAL
?
if we use channel_state_changed
to notify closed channels, would we just need to add the reasons for the closure (MUTUAL_USER
, MUTUAL_PEER
, UNILATERAL_EXPIRING_HTLC
, etc)?
According to doc/PLUGINS.md
it says a channel_state_changed
event looks like this and includes a cause
which indicates
from which side the channel was closed:
{
"channel_state_changed": {
"peer_id": "03bc9337c7a28bb784d67742ebedd30a93bacdf7e4ca16436ef3798000242b2251",
"channel_id": "a2d0851832f0e30a0cf778a826d72f077ca86b69f72677e0267f23f63a0599b4",
"short_channel_id" : "561820x1020x1",
"old_state": "CHANNELD_NORMAL",
"new_state": "CHANNELD_SHUTTING_DOWN",
"cause" : "remote",
"message" : "Peer closes channel"
}
}
A cause
can have the following values:
A feedback from a plugin developer on IRC.
channel_closed
notification would be nice to have.htlc_accepted
notification would be nice too (I interpreted as this specific user wanted to monitor the payloads and didn't need to customize, as I understood,lightningd
behaviour so a hook was unnecessary).Could I have theEDIT: Thanks !feature
request flag please ?.. :-)