Commit Graph

63 Commits

Author SHA1 Message Date
SomberNight 750d8cfab5 lnworker: run create_route_for_payment end-to-end, incl private edges
We pass the private edges to lnrouter, and let it find routes end-to-end.
Previously the edge_cost heuristics didn't apply to the private edges
and we were just randomly picking one of the route hints and use that.
So e.g. cheaper private edges were not preferred, but they are now.

PathEdge now stores both start_node and end_node; not just end_node.
2021-03-02 18:00:31 +01:00
SomberNight 1139720b58 lnworker: fix handle_error_code_from_failed_htlc for private channels
if the last (private) edge of the route errors, we need to try other route hints (if any)
2021-03-01 21:26:05 +01:00
SomberNight 2ec548dda3 ChannelDB: avoid duplicate (host,port) entries in ChannelDB._addresses
before:
node_id -> set of (host, port, ts)
after:
node_id -> NetAddress -> timestamp

Look at e.g. add_recent_peer; we only want to store
the last connection time, not all of them.
2021-01-09 19:56:05 +01:00
SomberNight 9a803cd1d6 ChannelDB: fix get_last_good_address 2021-01-09 18:41:41 +01:00
ThomasV 1161ce919f Move get_channel_info and get_channel_policy code, so that routing
hints can be created without access to a ChannelDB instance.
2020-11-25 08:53:19 +01:00
bitromortac 96c9a483d0 lnrater: follow-up
Add comment on node score and return copies of channel db dicts.
2020-11-17 10:48:42 +01:00
bitromortac cc9e19409f lnrater: module for node rating
Introduces LNRater, which analyzes the Lightning Network graph for
potential nodes to connect to by taking into account channel capacities,
channel open times and fee policies. A score is constructed to assign a
scalar to each node, which is then used to perform a weighted random
sampling of the nodes.
2020-11-06 08:00:23 +01:00
bitromortac 4efcb53d24 network: load gossip db early
The gossip db is loaded early when the network is started to save
time when the gui is locked and a wallet not yet loaded. Side effects
of the LNWallet to start peering when a channel db is loaded is
circumvented.
2020-10-22 18:05:51 +02:00
bitromortac 1eae324ddb channeldb: implement dictionary conversion
Implements a way to represent the graph (excluding one own's node) in
terms of a dict, which is json encodeable. Address tuples are converted
to NamedTuples to have automatic annotation in the address outputs.
2020-10-02 06:58:09 +02:00
ThomasV b505763867 Qt: do not show node_id in channels_list 2020-05-29 19:23:29 +02:00
ThomasV ac67f7ae30 discard channel updates too far in the future, or too close apart (see #6124) 2020-05-10 12:16:16 +02:00
SomberNight 7153e753d1 lnworker._pay: allow specifying path as argument
not exposed to CLI/etc yet but will be used in tests soon
2020-05-06 11:06:40 +02:00
ThomasV f4dc93cb7d lnworker: blacklist channel if policy is unchanged but has a new timestamp. 2020-04-24 12:16:21 +02:00
ThomasV 2d0ef78a11 channel_db: add verbose option to add_channel_update 2020-04-24 11:45:39 +02:00
ThomasV c454564ed6 sql_db: do not require network object 2020-04-16 10:58:40 +02:00
ThomasV 9224404108 Move callback manager out of Network class 2020-04-14 18:29:51 +02:00
SomberNight 71635216df ln feature bits: validate transitive feature deps everywhere 2020-04-01 21:49:19 +02:00
SomberNight 4b78bf94d4 lnaddr: add feature bit support to invoices
see https://github.com/lightningnetwork/lightning-rfc/pull/656
2020-04-01 21:42:52 +02:00
SomberNight 6ba08cc8d4 ln feature bits: flatten namespaces, and impl feature deps and ctxs
This implements:
- flat feature bits https://github.com/lightningnetwork/lightning-rfc/pull/666
- feature bit dependencies https://github.com/lightningnetwork/lightning-rfc/pull/719
2020-04-01 21:41:24 +02:00
SomberNight 3a73f6ee5c lnmsg.decode_msg: dict values for numbers are int, instead of BE bytes
Will be useful for TLVs where it makes sense to do the conversion in lnmsg,
as it might be more complicated than just int.from_bytes().
2020-04-01 21:39:52 +02:00
SomberNight 4c10a830f3 lnmsg: rewrite LN msg encoding/decoding 2020-04-01 21:39:48 +02:00
ThomasV beac1c4ddc channel_db: raise specific exception if database is not loaded when we try to find a route 2020-03-10 15:13:20 +01:00
SomberNight 99f736f3e7 ChannelDB.load_data: add comment re bad performance, and some speed-up
On my machine, ChannelDB.load_data() went from around 6 sec to 4 sec,
just by commenting out that assert in lnmsg.

related #6006
2020-03-03 04:05:36 +01:00
SomberNight 4d6b0184b9 ChannelDB: fix typo in sql query - seems harmless though? 2020-03-03 04:05:32 +01:00
SomberNight 3f9e761b67 ChannelDB: (trivial) add prefix to names of db methods
(and some type annotations)

This makes it clear these methods are not public.
2020-03-03 04:05:29 +01:00
SomberNight 53564f2496 ChannelDB: rm NodeAddress class, just use LNPeerAddr 2020-03-03 04:05:25 +01:00
SomberNight a97e7bae05 ChannelDB: make gossip sync progress updates cheaper
get_num_channels_partitioned_by_policy_count() was too slow
2020-03-02 16:56:15 +01:00
SomberNight 9cdc3287c1 ChannelDB: trivial fixes re node alias 2020-03-02 04:31:21 +01:00
SomberNight 5ac01ff6ae ChannelDB: fix get_recent_peers 2020-03-02 02:19:13 +01:00
SomberNight 67d24bf129 add LN gossip sync progress estimate indicator to Qt GUI 2020-02-29 20:03:35 +01:00
SomberNight fd56fb9189 ChannelDB: add self.lock and make it thread-safe 2020-02-29 20:03:31 +01:00
SomberNight a32af44ff9 trivial clean-up (typing/imports) 2020-02-28 20:27:35 +01:00
ThomasV 55a0043ab7 follow-up previous commit (fix tests) 2020-02-28 10:34:04 +01:00
ThomasV 97900c0985 store raw messages in gossip_db. Fixes #5960 2020-02-28 10:22:49 +01:00
ThomasV 9d0a862a43 revert prrevious commit (used in tests) 2020-02-20 11:26:19 +01:00
ThomasV 9680e7836c remove ChannelDB.add_channel_update (no longer needed after 46d8080c76) 2020-02-20 11:20:05 +01:00
SomberNight 46d8080c76 ln gossip: don't put own channels into db; always pass them to fn calls
Previously we would put fake chan announcement and fake outgoing chan upd
for own channels into db (to make path finding work). See Peer.add_own_channel().
Now, instead of above, we pass a "my_channels" param to the relevant ChannelDB methods.
2020-02-17 20:38:41 +01:00
SomberNight 24ebc77d76 ln chan verifier: fix code rot 2019-12-10 01:14:38 +01:00
SomberNight 13d6997355 LNPeerAddr: validate arguments
no longer subclassing NamedTuple (as it is difficult to do validation then...)
2019-11-26 00:15:33 +01:00
ThomasV a4944cdcb2 delete channel from db in remove_channel, becaose it is called from lnworker 2019-10-23 08:20:15 +02:00
SomberNight 106bc6d2b2 follow-up prev 2019-10-15 15:41:18 +02:00
ThomasV 0966edc637 fine-grained callbacks for lightning network dialog 2019-10-12 19:15:51 +02:00
ThomasV 3897cf725d move handle_error_code_from_failed_htlc to lnworker because it requires access to the network object 2019-10-12 18:22:19 +02:00
ThomasV 5377eb907c follow-up dd0be1541e 2019-10-12 12:59:38 +02:00
ThomasV dd0be1541e Improve handling of lightning payment status:
- Move 'handle_error_code_from_failed_htlc' to channel_db,
and call it from pay_to_route, because it should not be
called when HTLCs are forwarded.
- Replace 'payment_received' and 'payment_status'
callbacks with 'invoice_status' and 'request_status'.
- Show payment error logs in the Qt GUI
- In the invoices list, show paid invoices for which
we still have the log.
2019-10-11 17:51:33 +02:00
SomberNight 509df9ddaf create class for ShortChannelID and use it 2019-09-06 18:09:05 +02:00
SomberNight edf186da0d channeldb.load_data: attempt at fixing race
closes #5525
2019-09-05 18:32:45 +02:00
ThomasV bd57880799 do not raise exception when add_own_channel adds channel update from the cache 2019-09-04 08:01:08 +02:00
ThomasV e286ed1c13 add_own_channel does not need to be async 2019-09-03 21:01:45 +02:00
SomberNight fa5302bcfb (trivial) fix type annotation 2019-08-20 09:03:12 +02:00