1
0

fix confusion re max path length

This commit is contained in:
SomberNight
2018-10-20 16:50:43 +02:00
committed by ThomasV
parent 2fafd01945
commit 7edbd5682a
4 changed files with 9 additions and 8 deletions

View File

@@ -33,7 +33,7 @@ from cryptography.hazmat.backends import default_backend
from . import ecc
from .crypto import sha256, hmac_oneshot
from .util import bh2u, profiler, xor_bytes, bfh
from .lnutil import get_ecdh, PaymentFailure, NUM_MAX_HOPS_IN_PAYMENT_PATH
from .lnutil import get_ecdh, PaymentFailure, NUM_MAX_HOPS_IN_PAYMENT_PATH, NUM_MAX_EDGES_IN_PAYMENT_PATH
from .lnrouter import RouteEdge
@@ -191,8 +191,8 @@ def calc_hops_data_for_payment(route: List[RouteEdge], amount_msat: int, final_c
"""Returns the hops_data to be used for constructing an onion packet,
and the amount_msat and cltv to be used on our immediate channel.
"""
if len(route) > NUM_MAX_HOPS_IN_PAYMENT_PATH:
raise PaymentFailure(f"too long route ({len(route)} hops)")
if len(route) > NUM_MAX_EDGES_IN_PAYMENT_PATH:
raise PaymentFailure(f"too long route ({len(route)} edges)")
amt = amount_msat
cltv = final_cltv