routerrpc: add htlc notifier subscribed event
This commit is contained in:
6 files changed
+484
-376
No files matched your search
+449
-376
File diff suppressed because it is too large.
Load diff
@@ -618,6 +618,7 @@ message HtlcEvent {
|
||||
ForwardFailEvent forward_fail_event = 8;
|
||||
SettleEvent settle_event = 9;
|
||||
LinkFailEvent link_fail_event = 10;
|
||||
SubscribedEvent subscribed_event = 11;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -648,6 +649,9 @@ message SettleEvent {
|
||||
bytes preimage = 1;
|
||||
}
|
||||
|
||||
message SubscribedEvent {
|
||||
}
|
||||
|
||||
message LinkFailEvent {
|
||||
// Info contains details about the htlc that we failed.
|
||||
HtlcInfo info = 1;
|
||||
|
||||
@@ -1317,6 +1317,9 @@
|
||||
},
|
||||
"link_fail_event": {
|
||||
"$ref": "#/definitions/routerrpcLinkFailEvent"
|
||||
},
|
||||
"subscribed_event": {
|
||||
"$ref": "#/definitions/routerrpcSubscribedEvent"
|
||||
}
|
||||
},
|
||||
"title": "HtlcEvent contains the htlc event that was processed. These are served on a\nbest-effort basis; events are not persisted, delivery is not guaranteed\n(in the event of a crash in the switch, forward events may be lost) and\nsome events may be replayed upon restart. Events consumed from this package\nshould be de-duplicated by the htlc's unique combination of incoming and\noutgoing channel id and htlc id. [EXPERIMENTAL]"
|
||||
@@ -1748,6 +1751,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"routerrpcSubscribedEvent": {
|
||||
"type": "object"
|
||||
},
|
||||
"routerrpcUpdateChanStatusRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -900,6 +900,16 @@ func (s *Server) SubscribeHtlcEvents(req *SubscribeHtlcEventsRequest,
|
||||
}
|
||||
defer htlcClient.Cancel()
|
||||
|
||||
// Send out an initial subscribed event so that the caller knows the
|
||||
// point from which new events will be transmitted.
|
||||
if err := stream.Send(&HtlcEvent{
|
||||
Event: &HtlcEvent_SubscribedEvent{
|
||||
SubscribedEvent: &SubscribedEvent{},
|
||||
},
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case event := <-htlcClient.Updates():
|
||||
|
||||
Reference in new issue
Block a user