multi: ensure that BlockEpoch clients are cancelled

This commit fixes a prior goroutine leak that could result in a node
having thousands of goroutines, particularly due to many concurrent
channel fundings. We now ensure that for each BlockEpoch client
created, we ensure that the client is cancelled once the creating
grouting exits.
This commit is contained in:
Olaoluwa Osuntokun
2017-08-30 20:26:10 -07:00
parent 916ab454c1
commit 7be039adec
2 changed files with 3 additions and 0 deletions

View File

@@ -321,6 +321,7 @@ func (u *utxoNursery) incubator(newBlockChan *chainntnfs.BlockEpochEvent,
startingHeight uint32) {
defer u.wg.Done()
defer newBlockChan.Cancel()
currentHeight := startingHeight
out: