From 5425eff09c2c502f6a925ded8366cb8aade26b12 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 31 Jul 2017 21:06:55 -0700 Subject: [PATCH] multi: ensure all lnwallet.LightningChannel's are stopped MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit ensures that we always clean up the resources that are created when a new instance of a lnwallet.LightningChannel is instantiated. The is necessary due to the sigPool that’s now present as an internal goroutine. --- fundingmanager.go | 1 + rpcserver.go | 1 + 2 files changed, 2 insertions(+) diff --git a/fundingmanager.go b/fundingmanager.go index 52135c4a..aec8567a 100644 --- a/fundingmanager.go +++ b/fundingmanager.go @@ -1090,6 +1090,7 @@ func (f *fundingManager) waitForFundingConfirmation(completeChan *channeldb.Open fndgLog.Errorf("error creating new lightning channel: %v", err) return } + defer channel.Stop() // Next, we'll send over the funding locked message which marks that we // consider the channel open by presenting the remote party with our diff --git a/rpcserver.go b/rpcserver.go index 923cfb6b..62f3a414 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -563,6 +563,7 @@ func (r *rpcServer) CloseChannel(in *lnrpc.CloseChannelRequest, if err != nil { return err } + defer channel.Stop() _, bestHeight, err := r.server.cc.chainIO.GetBestBlock() if err != nil {