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.
This commit is contained in:
Conner Fromknecht 2018-04-09 16:44:53 -07:00
parent 16c304a4c1
commit 5c43e0ad02
No known key found for this signature in database
GPG Key ID: 39DE78FBE6ACB0EF

View File

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