Example #1
0
 def __init__(self, *, local_keypair: Keypair, chans: Iterable['Channel'],
              tx_queue):
     Logger.__init__(self)
     NetworkRetryManager.__init__(self,
                                  max_retry_delay_normal=1,
                                  init_retry_delay_normal=1)
     self.node_keypair = local_keypair
     self.network = MockNetwork(tx_queue)
     self.channel_db = self.network.channel_db
     self._channels = {chan.channel_id: chan for chan in chans}
     self.payments = {}
     self.logs = defaultdict(list)
     self.wallet = MockWallet()
     self.features = LnFeatures(0)
     self.features |= LnFeatures.OPTION_DATA_LOSS_PROTECT_OPT
     self.features |= LnFeatures.OPTION_UPFRONT_SHUTDOWN_SCRIPT_OPT
     self.pending_payments = defaultdict(asyncio.Future)
     for chan in chans:
         chan.lnworker = self
     self._peers = {}  # bytes -> Peer
     # used in tests
     self.enable_htlc_settle = asyncio.Event()
     self.enable_htlc_settle.set()
     self.received_htlcs = defaultdict(set)
     self.sent_htlcs = defaultdict(asyncio.Queue)
     self.htlc_routes = defaultdict(list)
Example #2
0
 def __init__(self, remote_keypair, local_keypair, chan: 'Channel', tx_queue):
     Logger.__init__(self)
     NetworkRetryManager.__init__(self, max_retry_delay_normal=1, init_retry_delay_normal=1)
     self.remote_keypair = remote_keypair
     self.node_keypair = local_keypair
     self.network = MockNetwork(tx_queue)
     self.channels = {chan.channel_id: chan}
     self.payments = {}
     self.logs = defaultdict(list)
     self.wallet = MockWallet()
     self.features = LnFeatures(0)
     self.features |= LnFeatures.OPTION_DATA_LOSS_PROTECT_OPT
     self.pending_payments = defaultdict(asyncio.Future)
     chan.lnworker = self
     chan.node_id = remote_keypair.pubkey
     # used in tests
     self.enable_htlc_settle = asyncio.Event()
     self.enable_htlc_settle.set()
Example #3
0
 def __init__(self, *, local_keypair: Keypair, chans: Iterable['Channel'], tx_queue, name):
     self.name = name
     Logger.__init__(self)
     NetworkRetryManager.__init__(self, max_retry_delay_normal=1, init_retry_delay_normal=1)
     self.node_keypair = local_keypair
     self.network = MockNetwork(tx_queue)
     self.taskgroup = TaskGroup()
     self.lnwatcher = None
     self.listen_server = None
     self._channels = {chan.channel_id: chan for chan in chans}
     self.payments = {}
     self.logs = defaultdict(list)
     self.wallet = MockWallet()
     self.features = LnFeatures(0)
     self.features |= LnFeatures.OPTION_DATA_LOSS_PROTECT_OPT
     self.features |= LnFeatures.OPTION_UPFRONT_SHUTDOWN_SCRIPT_OPT
     self.features |= LnFeatures.VAR_ONION_OPT
     self.features |= LnFeatures.PAYMENT_SECRET_OPT
     self.features |= LnFeatures.OPTION_TRAMPOLINE_ROUTING_OPT
     self.pending_payments = defaultdict(asyncio.Future)
     for chan in chans:
         chan.lnworker = self
     self._peers = {}  # bytes -> Peer
     # used in tests
     self.enable_htlc_settle = asyncio.Event()
     self.enable_htlc_settle.set()
     self.enable_htlc_forwarding = asyncio.Event()
     self.enable_htlc_forwarding.set()
     self.received_mpp_htlcs = dict()
     self.sent_htlcs = defaultdict(asyncio.Queue)
     self.sent_htlcs_routes = dict()
     self.sent_buckets = defaultdict(set)
     self.trampoline_forwarding_failures = {}
     self.inflight_payments = set()
     self.preimages = {}
     self.stopping_soon = False