funding: fix potential data race

localDiscoverySignals needs to be guarded by its mutex.  I was unable to
write a test case that would trigger a race under the race detector, but
better safe than sorry.
This commit is contained in:
Matt Morehouse 2022-09-19 10:55:45 -05:00
parent 202fcd6672
commit 54474d5cd7
No known key found for this signature in database
GPG Key ID: CC8ECA224831C982

View File

@ -634,7 +634,9 @@ func (f *Manager) start() error {
f.newChanBarriers[chanID] = make(chan struct{})
f.barrierMtx.Unlock()
f.localDiscoveryMtx.Lock()
f.localDiscoverySignals[chanID] = make(chan struct{})
f.localDiscoveryMtx.Unlock()
// Rebroadcast the funding transaction for any pending
// channel that we initiated. No error will be returned