rpc: only cancel closeObserver if force close succeeds

This commit is contained in:
Olaoluwa Osuntokun 2017-12-01 19:11:09 -08:00
parent 4d6cd2ee36
commit 7bd2cd0a16
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -824,7 +824,6 @@ func (r *rpcServer) CloseChannel(in *lnrpc.CloseChannelRequest,
}
defer func() {
channel.Stop()
channel.CancelObserver()
}()
_, bestHeight, err := r.server.cc.chainIO.GetBestBlock()
@ -872,6 +871,8 @@ func (r *rpcServer) CloseChannel(in *lnrpc.CloseChannelRequest,
},
}
channel.CancelObserver()
errChan = make(chan error, 1)
notifier := r.server.cc.chainNotifier
go waitForChanToClose(uint32(bestHeight), notifier, errChan, chanPoint,