From 5c43e0ad0231c88828694784d7f3e8d1e2bd38b2 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Mon, 9 Apr 2018 16:44:53 -0700 Subject: [PATCH] fundingmanager: fixes range-goroutine scoping bug This commit fixes an issue in funding manager startup, where a goroutine reads from a range value. The method in question could cause a channel to be announced at the wrong time. This may have been a cause for certain channels having phantom HTLCs before they had even received the funding locked message from the remote peer. This is fixed simply by using the locally scoped variable passed in as an argument to the goroutine. --- fundingmanager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fundingmanager.go b/fundingmanager.go index 2aac5b89..22b5d47c 100644 --- a/fundingmanager.go +++ b/fundingmanager.go @@ -640,7 +640,7 @@ func (f *fundingManager) Start() error { go func(dbChan *channeldb.OpenChannel) { defer f.wg.Done() - err = f.annAfterSixConfs(channel, shortChanID) + err = f.annAfterSixConfs(dbChan, shortChanID) if err != nil { fndgLog.Errorf("error sending channel "+ "announcement: %v", err)