lnd: manually set sig pending bit in commitment state machine

This commit fixes a class of bug which would trigger a never ending
loop of “null” commitment updates between two peers.
This commit is contained in:
Olaoluwa Osuntokun 2016-07-13 12:22:54 -07:00
parent 2926988710
commit 496d1e8edc
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -769,6 +769,7 @@ out:
peerLog.Errorf("unable to update "+ peerLog.Errorf("unable to update "+
"commitment: %v", err) "commitment: %v", err)
} }
state.sigPending = true
} }
case msg, ok := <-upstreamLink: case msg, ok := <-upstreamLink:
// If the upstream message link is closed, this signals // If the upstream message link is closed, this signals
@ -890,6 +891,7 @@ out:
"commitment: %v", err) "commitment: %v", err)
continue continue
} }
state.sigPending = true
state.htlcsToSettle = nil state.htlcsToSettle = nil
} }
case <-p.quit: case <-p.quit:
@ -921,8 +923,6 @@ func (p *peer) updateCommitTx(state *commitmentState) error {
} }
p.queueMsg(commitSig, nil) p.queueMsg(commitSig, nil)
state.sigPending = true
return nil return nil
} }