From 54474d5cd76fe4581ed0e8f102bbb6247d8288df Mon Sep 17 00:00:00 2001 From: Matt Morehouse Date: Mon, 19 Sep 2022 10:55:45 -0500 Subject: [PATCH 1/2] 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. --- funding/manager.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/funding/manager.go b/funding/manager.go index d10872bf6..500d4426c 100644 --- a/funding/manager.go +++ b/funding/manager.go @@ -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 From 179e7ceb08797b64a5050f1ee694c50ee453dbf5 Mon Sep 17 00:00:00 2001 From: Matt Morehouse Date: Mon, 19 Sep 2022 12:48:42 -0500 Subject: [PATCH 2/2] docs: update release notes --- docs/release-notes/release-notes-0.16.0.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/release-notes/release-notes-0.16.0.md b/docs/release-notes/release-notes-0.16.0.md index 658779676..4add94242 100644 --- a/docs/release-notes/release-notes-0.16.0.md +++ b/docs/release-notes/release-notes-0.16.0.md @@ -55,6 +55,9 @@ minimum version needed to build the project. * [Update Tor module](https://github.com/lightningnetwork/lnd/pull/6526) to allow the option to encrypt the private key on disk. +* [Fixed potential data race on funding manager + restart](https://github.com/lightningnetwork/lnd/pull/6929). + ## `lncli` * [Add an `insecure` flag to skip tls auth as well as a `metadata` string slice flag](https://github.com/lightningnetwork/lnd/pull/6818) that allows the @@ -97,6 +100,7 @@ minimum version needed to build the project. * ErikEk * hieblmi * Jesse de Wit +* Matt Morehouse * Olaoluwa Osuntokun * Oliver Gugger * Priyansh Rastogi