1
0

protect against getting robbed through routing fees

This commit is contained in:
SomberNight
2018-10-19 21:47:51 +02:00
committed by ThomasV
parent c577df8489
commit 2fafd01945
4 changed files with 102 additions and 40 deletions

View File

@@ -1,7 +1,7 @@
from enum import IntFlag, IntEnum
import json
from collections import namedtuple
from typing import NamedTuple, List, Tuple, Mapping
from typing import NamedTuple, List, Tuple, Mapping, Optional
import re
from .util import bfh, bh2u, inv_dict
@@ -16,6 +16,7 @@ from .i18n import _
from .lnaddr import lndecode
from .keystore import BIP32_KeyStore
HTLC_TIMEOUT_WEIGHT = 663
HTLC_SUCCESS_WEIGHT = 703
@@ -597,8 +598,6 @@ def generate_keypair(ln_keystore: BIP32_KeyStore, key_family: LnKeyFamily, index
return Keypair(*ln_keystore.get_keypair([key_family, 0, index], None))
from typing import Optional
class EncumberedTransaction(NamedTuple("EncumberedTransaction", [('tx', Transaction),
('csv_delay', Optional[int])])):
def to_json(self) -> dict:
@@ -612,3 +611,7 @@ class EncumberedTransaction(NamedTuple("EncumberedTransaction", [('tx', Transact
d2 = dict(d)
d2['tx'] = Transaction(d['tx'])
return EncumberedTransaction(**d2)
NUM_MAX_HOPS_IN_PAYMENT_PATH = 20