Merge pull request #4529 from cfromknecht/txnotifier-double-cancel

chainntnfs/txnotifier: remove events on teardown
This commit is contained in:
Olaoluwa Osuntokun 2020-08-12 21:03:29 -07:00 committed by GitHub
commit 7c11951b3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1959,19 +1959,21 @@ func (n *TxNotifier) TearDown() {
defer n.Unlock() defer n.Unlock()
for _, confSet := range n.confNotifications { for _, confSet := range n.confNotifications {
for _, ntfn := range confSet.ntfns { for confID, ntfn := range confSet.ntfns {
close(ntfn.Event.Confirmed) close(ntfn.Event.Confirmed)
close(ntfn.Event.Updates) close(ntfn.Event.Updates)
close(ntfn.Event.NegativeConf) close(ntfn.Event.NegativeConf)
close(ntfn.Event.Done) close(ntfn.Event.Done)
delete(confSet.ntfns, confID)
} }
} }
for _, spendSet := range n.spendNotifications { for _, spendSet := range n.spendNotifications {
for _, ntfn := range spendSet.ntfns { for spendID, ntfn := range spendSet.ntfns {
close(ntfn.Event.Spend) close(ntfn.Event.Spend)
close(ntfn.Event.Reorg) close(ntfn.Event.Reorg)
close(ntfn.Event.Done) close(ntfn.Event.Done)
delete(spendSet.ntfns, spendID)
} }
} }
} }