From 77d37298f48e1f613b559b2a73d8b8ebba089f91 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 26 Feb 2016 17:04:14 -0800 Subject: [PATCH] chainntfns: close all pending client channels on shutdown for BtcdNotifier --- chainntfs/btcdnotify/btcd.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/chainntfs/btcdnotify/btcd.go b/chainntfs/btcdnotify/btcd.go index b9951392..aebab70d 100644 --- a/chainntfs/btcdnotify/btcd.go +++ b/chainntfs/btcdnotify/btcd.go @@ -110,6 +110,16 @@ func (b *BtcdNotifier) Stop() error { close(b.quit) b.wg.Wait() + // Notify all pending clients of our shutdown by closing the related + // notification channels. + for _, spendClient := range b.spendNotifications { + close(spendClient.spendChan) + } + for _, confClient := range b.confNotifications { + close(confClient.finConf) + close(confClient.negativeConf) + } + return nil }