|
12 | 12 | from .constants import set_testnet, set_simnet |
13 | 13 | from .lnbase import Peer, Outpoint, ChannelConfig, LocalState, RemoteState, Keypair, OnlyPubkeyKeypair, OpenChannel, ChannelConstraints, RevocationStore, calc_short_channel_id, privkey_to_pubkey |
14 | 14 | from .lightning_payencode.lnaddr import lnencode, LnAddr, lndecode |
15 | | -from . import lnrouter |
16 | 15 | from .ecc import ECPrivkey, CURVE_ORDER, der_sig_from_sig_string |
17 | 16 | from .transaction import Transaction |
18 | | -from .lnwatcher import LNWatcher |
19 | 17 |
|
20 | 18 | is_key = lambda k: k.endswith("_basepoint") or k.endswith("_key") |
21 | 19 |
|
@@ -94,15 +92,12 @@ def __init__(self, wallet, network): |
94 | 92 | self.peers = {} |
95 | 93 | # view of the network |
96 | 94 | self.nodes = {} # received node announcements |
97 | | - self.channel_db = lnrouter.ChannelDB() |
98 | | - self.path_finder = lnrouter.LNPathFinder(self.channel_db) |
99 | 95 | self.channels = {x.channel_id: x for x in map(reconstruct_namedtuples, wallet.storage.get("channels", []))} |
100 | 96 | self.invoices = wallet.storage.get('lightning_invoices', {}) |
101 | 97 | peer_list = network.config.get('lightning_peers', node_list) |
102 | 98 | self.channel_state = {chan.channel_id: "DISCONNECTED" for chan in self.channels.values()} |
103 | | - self.lnwatcher = LNWatcher(network, self.channel_state) |
104 | 99 | for chan_id, chan in self.channels.items(): |
105 | | - self.lnwatcher.watch_channel(chan, self.on_channel_utxos) |
| 100 | + self.network.lnwatcher.watch_channel(chan, self.on_channel_utxos) |
106 | 101 | for host, port, pubkey in peer_list: |
107 | 102 | self.add_peer(host, int(port), pubkey) |
108 | 103 | # wait until we see confirmations |
@@ -199,7 +194,7 @@ def pay(self, invoice): |
199 | 194 | payment_hash = addr.paymenthash |
200 | 195 | invoice_pubkey = addr.pubkey.serialize() |
201 | 196 | amount_msat = int(addr.amount * COIN * 1000) |
202 | | - path = self.path_finder.find_path_for_payment(self.pubkey, invoice_pubkey, amount_msat) |
| 197 | + path = self.network.path_finder.find_path_for_payment(self.pubkey, invoice_pubkey, amount_msat) |
203 | 198 | if path is None: |
204 | 199 | raise Exception("No path found") |
205 | 200 | node_id, short_channel_id = path[0] |
|
0 commit comments