1
0
Commit Graph

71 Commits

Author SHA1 Message Date
SomberNight
a758c99bbe kivy: add "clear all gossip" button in ln gossip dialog
One usecase is perhaps to save space if using trampoline anyway...
more importantly, if using gossip, LNGossip is heavily filtering what messages we request and get,
and e.g. can missing new NodeAnnouncements, etc,
and this is a quick-and-dirty workaround to force a fresh start.
2022-06-02 18:28:21 +02:00
bitromortac
8913abdf9a python3.9: sample from list instead of set
electrum/electrum/channel_db.py:357: DeprecationWarning: Sampling from a
set deprecated since Python 3.9 and will be removed in a subsequent version.
2021-09-22 14:50:32 +02:00
bitromortac
e6ccbcf7b7 lnrouter: fix self-payments 2021-07-28 08:12:44 +02:00
SomberNight
2c047c72e1 (trivial) just add some TODOs 2021-03-23 17:30:40 +01:00
ThomasV
64a931f21e Deterministic NodeID:
- use_recoverable_channel is a user setting, available
   only in standard wallets with a 'segwit' seed_type
 - if enabled, 'lightning_xprv' is derived from seed
 - otherwise, wallets use the existing 'lightning_privkey2'

Recoverable channels:
 - channel recovery data is added funding tx using an OP_RETURN
 - recovery data = 4 magic bytes + node id[0:16]
 - recovery data is chacha20 encrypted using funding_address as nonce.
   (this will allow to fund multiple channels in the same tx)

GUI:
  - whether channels are recoverable is shown in wallet info dialog.
  - if the wallet can have recoverable channels but has an old node_id,
    users are told to close their channels and restore from seed
    to have that feature.
2021-03-19 10:17:02 +01:00
SomberNight
468f3b2b8d lnchannel: verify sig of remote chanupd (for inc edge of direct chan)
This is re the channel update for the incoming direction of our own channels.
This message can only come from the counterparty itself so maybe the sig check
is redundant... but for sanity I think we should check it anyway.
2021-03-16 19:07:31 +01:00
SomberNight
cedc71a8e3 ln gossip: make sure all signatures are verified
we have not been verifying signatures of ChannelUpdate messages...
(regression from 2d0ef78a11)
2021-03-15 20:44:20 +01:00
SomberNight
7243e5b763 channel_db: (fix) asyncio.Event.set() is not thread-safe
it must be called from asyncio thread
2021-03-15 17:54:13 +01:00
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