routing: skip max htlc validation when capacity is 0

Since light clients no longer have access to an edge's capacity, they
are unable to validate whether the max HTLC value for an updated edge
policy respects the capacity limit. As a stop-gap, we'll skip this
check.
This commit is contained in:
Wilmer Paulino 2019-04-17 13:25:40 -07:00
parent f2637d63ba
commit 5d3621cc83
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

@ -171,11 +171,15 @@ func validateOptionalFields(capacity btcutil.Amount,
return errors.Errorf("invalid max htlc for channel "+
"update %v", spew.Sdump(msg))
}
cap := lnwire.NewMSatFromSatoshis(capacity)
if maxHtlc > cap {
// For light clients, the capacity will not be set so we'll skip
// checking whether the MaxHTLC value respects the channel's
// capacity.
capacityMsat := lnwire.NewMSatFromSatoshis(capacity)
if capacityMsat != 0 && maxHtlc > capacityMsat {
return errors.Errorf("max_htlc(%v) for channel "+
"update greater than capacity(%v)", maxHtlc,
cap)
capacityMsat)
}
}