Skip to content

Commit

Permalink
cln_plugin: stop receiving htlc resolutions when cancelled
Browse files Browse the repository at this point in the history
  • Loading branch information
JssDWt committed May 13, 2024
1 parent c951e86 commit 84c3e0c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cln_plugin/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,10 @@ func (s *server) listenHtlcResponses() {
return
default:
resp := s.recvHtlcResolution()
if resp == nil {
continue
}

s.htlcRecvQueue <- &htlcResultMsg{
id: resp.Correlationid,
result: s.mapHtlcResult(resp.Outcome),
Expand All @@ -371,6 +375,10 @@ func (s *server) listenHtlcResponses() {
// has stopped.
func (s *server) recvHtlcResolution() *proto.HtlcResolution {
for {
if s.ctx.Err() != nil {
return nil
}

// make a copy of the used fields, to make sure state updates don't
// surprise us. The newSubscriber chan is swapped whenever a new
// subscriber arrives.
Expand Down

0 comments on commit 84c3e0c

Please sign in to comment.