Browse Source

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.
master
Wilmer Paulino 5 years ago
parent
commit
5d3621cc83
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F
  1. 10
      routing/ann_validation.go

10
routing/ann_validation.go

@ -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)
}
}

Loading…
Cancel
Save