From 9c0adae247fd9bd00e9d9b5055654c029103a6c0 Mon Sep 17 00:00:00 2001 From: Oleg Bondar Date: Thu, 21 Nov 2024 09:29:34 +0000 Subject: [PATCH] use mutex at stop --- chain/bitcoind_conn.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chain/bitcoind_conn.go b/chain/bitcoind_conn.go index 9c1f1e3c78..33b4f0e9e2 100644 --- a/chain/bitcoind_conn.go +++ b/chain/bitcoind_conn.go @@ -238,7 +238,8 @@ func (c *BitcoindConn) Stop() { if !atomic.CompareAndSwapInt32(&c.stopped, 0, 1) { return } - + c.subscriptionsMtx.Lock() + defer c.subscriptionsMtx.Unlock() for subscription := range c.subscriptions { close(subscription.txNtfns) close(subscription.blockNtfns)