From 1d172428c491070a33d04246c98c3ed64d2e55ba Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Fri, 4 May 2018 13:18:31 +0200 Subject: [PATCH] lnwallet/channel: return missing errors This commit corrects a few cases where we would encounter errors, but return nil by mistake. --- lnwallet/channel.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 2cf85c1e6..049132a6f 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -138,8 +138,7 @@ const ( // from the log. Adding a MalformedFail entry to ones log will modify // the _remote_ parties update log once a new commitment view has been // evaluated which contains the MalformedFail entry. The difference - // from Fail type lie in - // the different data we have to store. + // from Fail type lie in the different data we have to store. MalformedFail // Settle is an update type which settles a prior HTLC crediting the @@ -623,13 +622,13 @@ func (c *commitment) populateHtlcIndexes() error { for i := 0; i < len(c.outgoingHTLCs); i++ { htlc := &c.outgoingHTLCs[i] if err := populateIndex(htlc, false); err != nil { - return nil + return err } } for i := 0; i < len(c.incomingHTLCs); i++ { htlc := &c.incomingHTLCs[i] if err := populateIndex(htlc, true); err != nil { - return nil + return err } } @@ -1640,7 +1639,7 @@ func (lc *LightningChannel) restoreCommitState( // extended to the remote party but which was never ACK'd. pendingRemoteCommitDiff, err = lc.channelState.RemoteCommitChainTip() if err != nil && err != channeldb.ErrNoPendingCommit { - return nil + return err } if pendingRemoteCommitDiff != nil {