Skip to content

Commit 47a1d3f

Browse files
authored
Merge pull request #955 from halseth/neutrinonotify-epoch-queue
[small] neutrinonotify: use epochqueue to notify block epochs
2 parents 000e77f + 891fb20 commit 47a1d3f

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

chainntnfs/neutrinonotify/neutrino.go

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -528,24 +528,14 @@ func (n *NeutrinoNotifier) notifyBlockEpochs(newHeight int32, newSha *chainhash.
528528
}
529529

530530
for _, epochClient := range n.blockEpochClients {
531-
n.wg.Add(1)
532-
epochClient.wg.Add(1)
533-
go func(ntfnChan chan *chainntnfs.BlockEpoch, cancelChan chan struct{},
534-
clientWg *sync.WaitGroup) {
531+
select {
535532

536-
defer clientWg.Done()
537-
defer n.wg.Done()
533+
case epochClient.epochQueue.ChanIn() <- epoch:
538534

539-
select {
540-
case ntfnChan <- epoch:
535+
case <-epochClient.cancelChan:
541536

542-
case <-cancelChan:
543-
return
544-
545-
case <-n.quit:
546-
return
547-
}
548-
}(epochClient.epochChan, epochClient.cancelChan, &epochClient.wg)
537+
case <-n.quit:
538+
}
549539
}
550540
}
551541

0 commit comments

Comments
 (0)