contractcourt: add locks in SubscribeChannelEvents

This commit is contained in:
yyforyongyu 2024-04-08 11:02:03 +08:00
parent 07466c4f8c
commit c644deb49f
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868

View File

@ -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)