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
6
peer.go
6
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 {
|
||||
errChan <- err
|
||||
if err != nil {
|
||||
if errChan != nil {
|
||||
errChan <- err
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user