1
0
Commit Graph

95 Commits

Author SHA1 Message Date
ThomasV
ded449233e Trampoline routing.
- trampoline is enabled by default in config, to prevent download of `gossip_db`.
   (if disabled, `gossip_db` will be downloaded, regardless of the existence of channels)
 - if trampoline is enabled:
    - the wallet can only open channels with trampoline nodes
    - already-existing channels with non-trampoline nodes are frozen for sending.
 - there are two types of trampoline payments: legacy and end-to-end (e2e).
 - we decide to perform legacy or e2e based on the invoice:
    - we use trampoline_routing_opt in features to detect Eclair and Phoenix invoices
    - we use trampoline_routing_hints to detect Electrum invoices
 - when trying a legacy payment, we add a second trampoline to the path to preserve privacy.
   (we fall back to a single trampoline if the payment fails for all trampolines)
 - the trampoline list is hardcoded, it will remain so until `trampoline_routing_opt` feature flag is in INIT.
 - there are currently only two nodes in the hardcoded list, it would be nice to have more.
 - similar to Phoenix, we find the fee/cltv by trial-and-error.
    - if there is a second trampoline in the path, we use the same fee for both.
    - the final spec should add fee info in error messages, so we will be able to fine-tune fees
2021-02-17 17:28:13 +01:00
ThomasV
ad91257729 pass blacklist to lnrouter.find_route, so that lnrouter is stateless (see #6778) 2021-01-11 15:19:50 +01:00
ThomasV
d5c360a958 simplify lnrouter API 2021-01-11 12:49:35 +01:00
SomberNight
01fe443928 lnrouter: nicer repr for PathEdge and RouteEdge 2020-11-24 23:44:09 +01:00
ThomasV
526c75ad53 lnrouter: blacklist channels for a limited time (see #6124) 2020-05-10 12:37:27 +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
SomberNight
63b18dc30f lnrouter: add PathEdge/LNPaymentPath for (node_id, scid) 2020-05-06 11:06:37 +02:00
ThomasV
1a4d33086b refactoring: remove inspect_edge 2020-04-20 11:48:38 +02:00
ThomasV
ec5330fc21 separate method that runs Dijkstra and return distances 2020-04-20 11:47:29 +02:00
SomberNight
30bf32b34b use option varonion: actually use TLV payloads, and signal support 2020-04-01 21:47:42 +02:00
SomberNight
90f3b667aa small clean-up re max CLTV delta for LN 2020-03-30 02:46:14 +02:00
SomberNight
3ed6afce64 lnchannel: implement freezing channels (for receiving)
A bit weird, I know... :)
It allows for rebalancing our own channels! :P
2020-03-26 09:05:15 +01:00
ThomasV
df15042cee Quantitative easing of lightning fees 2020-03-16 14:47:40 +01:00
ThomasV
b6cb983733 lnworker.pay: run path finding in sep. thread (don't block evt loop) 2020-03-10 17:56:11 +01:00
SomberNight
c95c0dcb80 lnrouter: add comments about path-finding blocking the asyncio loop 2020-03-09 20:39:13 +01:00
SomberNight
cdb72509a7 lnrouter: change edge cost estimate (distance metric)
Old estimate was heavily biased towards simply minimising CLTV sum.
(fees had a too low weight; typically they were ~noise)
Now also take payment_amount into account.
2020-03-03 02:12:42 +01:00
SomberNight
c81335fb44 lnrouter: simplify max fee sanity checks 2020-03-02 19:55:11 +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
b99add59c3 lnworker: introduce PaymentAttemptLog NamedTuple 2019-12-10 03:17:57 +01:00
SomberNight
d4da4aa56c lnrouter: fix off-by-one in NUM_MAX_EDGES_IN_PAYMENT_PATH 2019-09-06 18:36:21 +02:00
SomberNight
509df9ddaf create class for ShortChannelID and use it 2019-09-06 18:09:05 +02:00
ThomasV
246cda2928 fix Flake8 tests 2019-08-20 09:03:12 +02:00
SomberNight
beeb81e179 lnpeer: use correct failure codes in _maybe_forward_htlc 2019-08-20 09:03:12 +02:00
SomberNight
d955285808 lnrouter/channeldb: small import clean-up 2019-08-20 09:03:12 +02:00
ThomasV
e43a3bc63a follow-up prev commit: pass is_mine to _edge_cost 2019-08-20 09:03:12 +02:00
ThomasV
b55f9e9e6a Do not route through channels for which we did not receive
both updates, because this often means one of the nodes is
offline.
2019-08-20 09:03:12 +02:00
ThomasV
f2d58d0e3f optimize channel_db:
- use python objects mirrored by sql database
 - write sql to file asynchronously
 - the sql decorator is awaited in sweepstore, not in channel_db
2019-08-20 09:03:12 +02:00
ThomasV
180f6d34be separate channel_db module 2019-08-20 09:03:12 +02:00
ThomasV
115113f492 remove expensive sql request, python set comparison is faster 2019-08-20 09:03:12 +02:00
SomberNight
9a0ba7fa79 ChannelDB: trivial bugfix for get_channels_for_node 2019-08-20 09:03:11 +02:00
SomberNight
62f58c18fe ChannelDB.on_node_announcement: some speed-up
(e.g. for 100 node anns, was ~5 seconds, now 0.7 sec; so still slow)
2019-08-20 09:03:11 +02:00
SomberNight
cffb89002c fix ChannelDB.compare_channels: was raising "too many SQL variables"
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) too many SQL variables
2019-08-20 09:03:11 +02:00
ThomasV
0acd0c23d3 fix: key must be unique (sql) 2019-08-20 09:03:11 +02:00
ThomasV
eb4e6bb0de improve filter_channel_updates
blacklist channels that do not really get updated
2019-08-20 09:03:11 +02:00
ThomasV
b055eeace2 prune channels older than two weeks from database 2019-08-20 09:03:11 +02:00
ThomasV
522ce5bb9f verify channel updates in peer's TaskGroup 2019-08-20 09:03:11 +02:00
ThomasV
308dc6aa6b use a single queue for gossip messages, so that they are processed in the correct order 2019-08-20 09:03:11 +02:00
ThomasV
e68f318b12 verify node and channel announcements before entering sql lock 2019-08-20 09:03:11 +02:00
ThomasV
0e42fd9f17 parallelize short_channel_id requests 2019-08-20 09:03:11 +02:00
ThomasV
1011245c5e LNGossip: sync channel db using query_channel_range 2019-08-20 09:03:11 +02:00
ThomasV
31684abb51 do not SPV channel announcements; this is too resource intensive 2019-08-20 09:03:11 +02:00
SomberNight
cc57da704b logging: adapt lightning branch to logging changes 2019-08-20 09:03:11 +02:00
ThomasV
34f22e6681 lnrouter: load data before finding path 2019-08-20 09:03:11 +02:00
ThomasV
b76728d459 lnrouter: fix get_last_good_address: one_or_none -> all 2019-08-20 09:03:11 +02:00
ThomasV
93e8d4f953 channel_db: fix timestamp_range, reduce verbosity 2019-08-20 09:03:11 +02:00
ThomasV
aa398993cf lnrouter fixes:
- use gossip_queries_req instead of initial_routing_sync
 - add connected nodes to recent peers only after successful init
 - derive timestamp used with gossip_timestamp_filter from channel_db
 - fix query_short_channel_ids:
     1. channel IDs must be sorted with zlib
     2. limit request to 100
     3. do not abuse this to request node_announcements; it is fine not to have all nodes.
 - fix get_recent_peers:
     1. do not set last_connected_date to 'now' if we never connected a node
     2. sql query was misconstructed and was returning only one peer
 - populate FALLBACK_NODE_LIST_MAINNET with nodes that have the requested flags
2019-08-20 09:03:11 +02:00
ThomasV
e7888a50be fix sql conflicts in lnrouter 2019-08-20 09:03:11 +02:00
ThomasV
2c80996fbf lnrouter: fix primary key conflict in Policy update 2019-08-20 09:03:11 +02:00
ThomasV
02d013421a lnwatcher: store transactions as binary 2019-08-20 09:03:11 +02:00
ThomasV
d8e9a9a49e create parent class for sql databases 2019-08-20 09:03:11 +02:00