def __init__(self, wallet: 'Abstract_Wallet', xprv):
    self.wallet = wallet
    self.db = wallet.db
    Logger.__init__(self)
    LNWorker.__init__(self, xprv, LNWALLET_FEATURES)
    self.config = wallet.config
    self.lnwatcher = None
    self.lnrater: LNRater = None
    self.payments = self.db.get_dict('lightning_payments')
    self.preimages = self.db.get_dict('lightning_preimages')
    self.sweep_address = wallet.get_new_sweep_address_for_channel()
    self.logs = defaultdict(list)
    self.enable_htlc_settle = True
    self.enable_htlc_forwarding = True
    self._channels = {}
    channels = self.db.get_dict('channels')
    for (channel_id, c) in random_shuffled_copy(channels.items()):
        self._channels[bfh(channel_id)] = Channel(c, sweep_address=self.sweep_address, lnworker=self)
    self._channel_backups = {}
    for name in ['onchain_channel_backups', 'imported_channel_backups']:
        channel_backups = self.db.get_dict(name)
        for (channel_id, storage) in channel_backups.items():
            self._channel_backups[bfh(channel_id)] = ChannelBackup(storage, sweep_address=self.sweep_address, lnworker=self)
    self.sent_htlcs = defaultdict(asyncio.Queue)
    self.sent_htlcs_routes = dict()
    self.sent_buckets = dict()
    self.received_mpp_htlcs = dict()
    self.swap_manager = SwapManager(wallet=self.wallet, lnworker=self)
    self.inflight_payments = set()
    for payment_hash in self.get_payments(status='inflight').keys():
        self.set_invoice_status(payment_hash.hex(), PR_INFLIGHT)
    self.trampoline_forwarding_failures = {}
def __init__(self, wallet: 'Abstract_Wallet', xprv):
    self.wallet = wallet
    self.db = wallet.db
    Logger.__init__(self)
    LNWorker.__init__(self, xprv, LNWALLET_FEATURES)
    self.config = wallet.config
    self.lnwatcher = None
    self.lnrater: LNRater = None
    self.payments = self.db.get_dict('lightning_payments')
    self.preimages = self.db.get_dict('lightning_preimages')
    self.sweep_address = wallet.get_new_sweep_address_for_channel()
    self.logs = defaultdict(list)
    self.enable_htlc_settle = True
    self.enable_htlc_forwarding = True
    self._channels = {}
    channels = self.db.get_dict('channels')
    for (channel_id, c) in random_shuffled_copy(channels.items()):
        self._channels[bfh(channel_id)] = Channel(c, sweep_address=self.sweep_address, lnworker=self)
    self._channel_backups = {}
    for name in ['onchain_channel_backups', 'imported_channel_backups']:
        channel_backups = self.db.get_dict(name)
        for (channel_id, storage) in channel_backups.items():
            self._channel_backups[bfh(channel_id)] = ChannelBackup(storage, sweep_address=self.sweep_address, lnworker=self)
    self.sent_htlcs = defaultdict(asyncio.Queue)
    self.sent_htlcs_routes = dict()
    self.sent_buckets = dict()
    self.received_mpp_htlcs = dict()
    self.swap_manager = SwapManager(wallet=self.wallet, lnworker=self)
    self.inflight_payments = set()
    for payment_hash in self.get_payments(status='inflight').keys():
        self.set_invoice_status(payment_hash.hex(), PR_INFLIGHT)
    self.trampoline_forwarding_failures = {}