mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-13 11:09:23 +01:00
peer: fix panic bug in watiForChanToClose
This commit fixes a panic bug in the watiForChanToClose method caused by a logic error leading to the return value of the function at times being a nil pointer in the case that an error occurred. We now avoid such an error by _always_ returning from the function if there’s an error, but conditionally (in a diff if-clause) sending an error over the error channel.
This commit is contained in:
parent
40a7523b8f
commit
620695542c
1 changed files with 4 additions and 2 deletions
4
peer.go
4
peer.go
|
@ -1069,8 +1069,10 @@ func waitForChanToClose(bestHeight uint32, notifier chainntnfs.ChainNotifier,
|
|||
// TODO(roasbeef): add param for num needed confs
|
||||
confNtfn, err := notifier.RegisterConfirmationsNtfn(closingTxID, 1,
|
||||
bestHeight)
|
||||
if err != nil && errChan != nil {
|
||||
if err != nil {
|
||||
if errChan != nil {
|
||||
errChan <- err
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue