1
0

some more type annotations that needed conditional imports

This commit is contained in:
SomberNight
2018-10-22 15:35:57 +02:00
committed by ThomasV
parent f3d1f71e94
commit f70e679aba
8 changed files with 65 additions and 33 deletions

View File

@@ -24,7 +24,7 @@
# SOFTWARE.
import hashlib
from typing import Sequence, List, Tuple, NamedTuple
from typing import Sequence, List, Tuple, NamedTuple, TYPE_CHECKING
from enum import IntEnum, IntFlag
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms
@@ -34,7 +34,9 @@ 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, NUM_MAX_EDGES_IN_PAYMENT_PATH
from .lnrouter import RouteEdge
if TYPE_CHECKING:
from .lnrouter import RouteEdge
HOPS_DATA_SIZE = 1300 # also sometimes called routingInfoSize in bolt-04
@@ -186,7 +188,7 @@ def new_onion_packet(payment_path_pubkeys: Sequence[bytes], session_key: bytes,
hmac=next_hmac)
def calc_hops_data_for_payment(route: List[RouteEdge], amount_msat: int, final_cltv: int) \
def calc_hops_data_for_payment(route: List['RouteEdge'], amount_msat: int, final_cltv: int) \
-> Tuple[List[OnionHopsDataSingle], int, int]:
"""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.