// TrueRouteLength returns the "true" length of the PaymentPath. The max
// payment path is NumMaxHops size, but in practice routes are much smaller.
// This method will return the number of actual hops (nodes) involved in this
// route. For references, a direct path has a length of 1, path through an
// intermediate node has a length of 2 (3 nodes involved).
TrueRouteLength returns the "true" length of the PaymentPath. The max
payment path is NumMaxHops size, but in practice routes are much smaller.
This method will return the number of actual hops (nodes) involved in this
route. For references, a direct path has a length of 1, path through an
intermediate node has a length of 2 (3 nodes involved).
// TrueRouteLength returns the " true " length of the PaymentPath . The max // payment path is NumMaxHops size but in practice routes are much smaller . // This method will return the number of actual hops ( nodes ) involved in this // route . For references a direct path has a length of 1 path through an // intermediate node has a length of 2 ( 3 nodes involved ) .
func (p *PaymentPath) TrueRouteLength() int {
	var routeLength int
	for _, hop := range p {
		if hop.IsEmpty() {
			return routeLength
		}
		routeLength++
	}
	return routeLength
}
func ( p * PaymentPath ) TrueRouteLength ( ) int { var routeLength int for _ , hop := range p { if hop . IsEmpty ( ) { return routeLength } routeLength ++ } return routeLength }
TrueRouteLength returns the "true" length of the PaymentPath.
TrueRouteLength returns the " true " length of the PaymentPath .
// When we hit the first empty hop, we know we're now in the // zero'd out portion of the array.