Commit graph

70 commits

Author SHA1 Message Date
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
ThomasV
29afe52b4c sqlite: do not use scoped_session 2019-08-20 09:03:11 +02:00
ThomasV
436c313790 follow-up previous commit 2019-08-20 09:03:11 +02:00
ThomasV
46aa5c1958 lnrouter: perform SQL requests in a separate thread. persist database. 2019-08-20 09:03:11 +02:00
ThomasV
9f188c087c Flatten the structure of lnrouter, so that DBSession is not used outside of ChannelDB 2019-08-20 09:03:11 +02:00
Janus
95a2174789 sqlite in lnrouter: lnpeer: introduce _gossip_loop for gossip handling separated from message handling 2019-08-20 09:03:11 +02:00
Janus
3442e51fac sqlite in lnrouter: remove useless InDB suffix 2019-08-20 09:03:11 +02:00
Janus
945e1dc4ee sqlite in lnrouter: request missing channel_announcements and node_announcements 2019-08-20 09:03:11 +02:00
Janus
d2d67f1fe1 sqlite in lnrouter: avoid exceptions on shutdown 2019-08-20 09:03:11 +02:00
Janus
dd7c4b3bab sqlite in lnrouter 2019-08-20 09:03:11 +02:00
ThomasV
3dce65dc73 Rename lnchan, lnchannel_verifier, lnbase
Auto-completions are a pain if files share a long prefix
2019-08-20 09:03:11 +02:00
Janus
56853da391 qt main_window: do not unregister on shutdown
this is handled differently in lightning, see commit

commit 6e355601261a60d143561f15760cc48f9c81d000
Author: ThomasV <thomasv@electrum.org>
Date:   Sun Jun 3 10:07:56 2018 +0200

    integrate channels_list with existing framework
2019-08-20 09:03:11 +02:00
ThomasV
3222e26e01 format message 2019-08-20 09:03:11 +02:00
ThomasV
f4b9d2f47c show lightning network capacity in GUI 2019-08-20 09:03:11 +02:00
SomberNight
5b7c801ca4 after rebase fixes 2019-08-20 09:03:11 +02:00
SomberNight
c0ae7b5534 after rebase clean-up 2019-08-20 09:03:10 +02:00
SomberNight
f70e679aba some more type annotations that needed conditional imports 2019-08-20 09:03:10 +02:00
SomberNight
bd48072e04 lnrouter: can_pay for own channels should use amount_to_forward 2019-08-20 09:03:10 +02:00
SomberNight
2364de930b lnrouter: run Dijkstra in reverse direction 2019-08-20 09:03:10 +02:00
SomberNight
7edbd5682a fix confusion re max path length 2019-08-20 09:03:10 +02:00
SomberNight
2fafd01945 protect against getting robbed through routing fees 2019-08-20 09:03:10 +02:00
SomberNight
56c0983e69 fix multi-hop payments 2019-08-20 09:03:10 +02:00
SomberNight
2e5552816c if payment fails with UPDATE onion error, also utilise channel_update for private channels 2019-08-20 09:03:10 +02:00
SomberNight
52377dbfa0 lnrouter: use htlc_maximum_msat 2019-08-20 09:03:10 +02:00
ThomasV
8bb23ea2cd follow-up prev commit: channel_flags, message_flags, htlc_maximum_msat 2019-08-20 09:03:10 +02:00
SomberNight
a91e244a05 path finding: minor clean-up 2019-08-20 09:03:10 +02:00