From c644deb49f2f5246c4bc6afdb74d3a4876878dfd Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Mon, 8 Apr 2024 11:02:03 +0800 Subject: [PATCH] contractcourt: add locks in `SubscribeChannelEvents` --- contractcourt/chain_arbitrator.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contractcourt/chain_arbitrator.go b/contractcourt/chain_arbitrator.go index e08618307..fbddd81f0 100644 --- a/contractcourt/chain_arbitrator.go +++ b/contractcourt/chain_arbitrator.go @@ -1223,7 +1223,10 @@ func (c *ChainArbitrator) SubscribeChannelEvents( // First, we'll attempt to look up the active watcher for this channel. // If we can't find it, then we'll return an error back to the caller. + c.Lock() watcher, ok := c.activeWatchers[chanPoint] + c.Unlock() + if !ok { return nil, fmt.Errorf("unable to find watcher for: %v", chanPoint)