lnwallet: clarify comment within commitment state sanity function
This commit is contained in:
parent
9676d476c9
commit
2e05051176
@ -1712,7 +1712,7 @@ func (lc *LightningChannel) validateCommitmentSanity(theirLogCounter,
|
|||||||
htlcCount := 0
|
htlcCount := 0
|
||||||
|
|
||||||
// If we adding or receiving the htlc we increase the number of htlcs
|
// If we adding or receiving the htlc we increase the number of htlcs
|
||||||
// by one in order to not overflow the commitment transasction by
|
// by one in order to not overflow the commitment transaction by
|
||||||
// insertion.
|
// insertion.
|
||||||
if prediction {
|
if prediction {
|
||||||
htlcCount++
|
htlcCount++
|
||||||
@ -1748,10 +1748,11 @@ func (lc *LightningChannel) validateCommitmentSanity(theirLogCounter,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// In case of addition of htlc add update we should use the half
|
// If we're validating the commitment sanity for HTLC _log_ update by a
|
||||||
// of the capacity of the commitment transaction, if we use the full
|
// particular side, then we'll only consider half of the available HTLC
|
||||||
// capacity it will lead to situioaton when we might reject the
|
// bandwidth. However, if we're validating the _creation_ of a new
|
||||||
// remote htlc update which will lead desynchronization of state.
|
// commitment state, then we'll use the full value as the sum of the
|
||||||
|
// contribution of both sides shouldn't exceed the max number.
|
||||||
var maxHTLCNumber int
|
var maxHTLCNumber int
|
||||||
if local && remote {
|
if local && remote {
|
||||||
maxHTLCNumber = MaxHTLCNumber
|
maxHTLCNumber = MaxHTLCNumber
|
||||||
@ -1762,6 +1763,7 @@ func (lc *LightningChannel) validateCommitmentSanity(theirLogCounter,
|
|||||||
if htlcCount > maxHTLCNumber {
|
if htlcCount > maxHTLCNumber {
|
||||||
return ErrMaxHTLCNumber
|
return ErrMaxHTLCNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user