From 7252dbd934417acf4353fa6df5fad90a9bda35db Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Wed, 28 Feb 2018 23:29:49 +0100 Subject: [PATCH] funding: add missing mutex around activeReservations --- fundingmanager.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fundingmanager.go b/fundingmanager.go index 7c17fb3a..e1e98872 100644 --- a/fundingmanager.go +++ b/fundingmanager.go @@ -835,12 +835,15 @@ func (f *fundingManager) handleFundingOpen(fmsg *fundingOpenMsg) { // TODO(roasbeef): modify to only accept a _single_ pending channel per // block unless white listed + f.resMtx.RLock() if len(f.activeReservations[peerIDKey]) >= cfg.MaxPendingChannels { + f.resMtx.RUnlock() f.failFundingFlow( fmsg.peerAddress.IdentityKey, fmsg.msg.PendingChannelID, lnwire.ErrMaxPendingChannels) return } + f.resMtx.RUnlock() // We'll also reject any requests to create channels until we're fully // synced to the network as we won't be able to properly validate the