From 5d3621cc839b85c63c36d8fc480539fe9c67fb81 Mon Sep 17 00:00:00 2001 From: Wilmer Paulino Date: Wed, 17 Apr 2019 13:25:40 -0700 Subject: [PATCH] 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. --- routing/ann_validation.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/routing/ann_validation.go b/routing/ann_validation.go index 184d7009..cc8530bb 100644 --- a/routing/ann_validation.go +++ b/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) } }