Improved channel_state_changed
notifications
#7841
Labels
component::plugin-infra
Issues related to the lightningd <> plugin interactions and protocol
Feature Request
reconnect
We currently have the
channel_state_changed
notifications(docs) that is emitted whenever the state of the
channel state machine changes. This is rather coarse-grained, and is
missing an orthogonal state: the connection status of the peer
connection this channel is managed over.
So we end up tracking two separate state machines:
current connection status
the channel is actually usable or it would just be if the peer were
connected.
We found that the coarse grained notifications are not detailed enough
to make informed decisions. In the case of an always-on node it may be
ok to assume that any channel that is connected and
CHANNELD_NORMAL
can also be used, however that leaves the window open for the
connection_state=connected
+channel_state=CHANNELD_NORMAL
state,because the peer may have just reconnected, and we might still be
exchanging
WIRE_REESTABLISH
messages. If we try to use the channelin this state we'll get an error for the first peer not being
ready. This can be hit by any node, but Greenlight nodes regularly
have this situation, and we partially addressed it by tailing the logs
and tracking the state ourselves. However we believe this could be
useful for any node operator and a good basis for more advanced
plugins.
Possible Solutions
This issue can be solved in two ways:
channel_state_changed
notification to alsoinclude the connection state. This means we are now emitting the
notification more often, i.e., the same
new
state will besignaled multiple times, when we have a connection state machine
change we'd end up with a notification with
old_state
andnew_state
are the same, but a newconnection_state
would tellus what changed in the connection.
channel_state
notification, whose semantics aredefined as returning the vector of states, and being emitted
whenever any of the states changes. This has the advantage of
not breaking existing listeners of
channel_state_changed
, butcomes with a whole new notification, and we'd likely want to
deprecate
channel_state_changed
to minimize redundancy.The text was updated successfully, but these errors were encountered: