diff --git a/routing/payment_session.go b/routing/payment_session.go index 4b766d4c0207..c1fe6e827657 100644 --- a/routing/payment_session.go +++ b/routing/payment_session.go @@ -298,6 +298,15 @@ func (p *paymentSession) RequestRoute(maxAmt, feeLimit lnwire.MilliSatoshi, // route, try it for half the amount. maxAmt /= 2 + // If this shard ends up being too large, then we'll + // clamp it down to the max shard size if that's set. + // + // TODO(roasbeef): extend the integrated routing tets w/ info + maxShardActive := p.payment.MaxShardAmt != nil + if maxShardActive && *p.payment.MaxShardAmt > maxAmt { + maxAmt = *p.payment.MaxShardAmt + } + // Put a lower bound on the minimum shard size. if maxAmt < p.minShardAmt { p.log.Debugf("not splitting because minimum "+