peer: send any pending HTLC settles when the commit timer ticks
This commit adds an additional clause to the update of the current commitment state each time the commitTimer ticks. We now additional check to see if we have any active HTLC’s to settle, triggering a state update if so. This case is needed due to the possibility of desynchronization across commitment transactions. As an example if any HTLC adds are sent after the remote node receives our ack-sig, then they may remain uncommitted within our local commitment chain. The addition of this check solves the issue by ensuring convergence towards a symmetric commitment state.
This commit is contained in:
parent
f1d0b75b9d
commit
cfdf3f3ab5
4
peer.go
4
peer.go
@ -56,6 +56,7 @@ type chanSnapshotReq struct {
|
|||||||
// for managing any channel state related to this peer. To do so, it has several
|
// for managing any channel state related to this peer. To do so, it has several
|
||||||
// helper goroutines to handle events such as HTLC timeouts, new funding
|
// helper goroutines to handle events such as HTLC timeouts, new funding
|
||||||
// workflow, and detecting an uncooperative closure of any active channels.
|
// workflow, and detecting an uncooperative closure of any active channels.
|
||||||
|
// TODO(roasbeef): proper reconnection logic
|
||||||
type peer struct {
|
type peer struct {
|
||||||
// MUST be used atomically.
|
// MUST be used atomically.
|
||||||
started int32
|
started int32
|
||||||
@ -975,7 +976,8 @@ out:
|
|||||||
// pending updates we need to commit. If so, then send
|
// pending updates we need to commit. If so, then send
|
||||||
// an update incrementing the unacked counter is
|
// an update incrementing the unacked counter is
|
||||||
// succesful.
|
// succesful.
|
||||||
if !state.channel.PendingUpdates() {
|
if !state.channel.PendingUpdates() &&
|
||||||
|
len(state.htlcsToSettle) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user