Commit Graph

102 Commits

Author SHA1 Message Date
ThomasV
6ddd02506e test_lnpeer: add missing parameter in pay_to_route 2021-03-06 10:59:29 +01:00
ThomasV
83993768e5 trampoline: do not add node in trampoline hints if it already is
the last trampoline of the route
2021-03-06 10:46:58 +01:00
ThomasV
59547d0513 test_lnpeer: variables must be declared in MockLNWallet.__init__ 2021-03-05 17:04:26 +01:00
ThomasV
1f60d5d8ee test_lnpeer: add test for trampoline 2021-03-05 13:00:24 +01:00
ThomasV
3fa1aed8cd add unit test for basic mpp 2021-03-03 12:52:52 +01:00
SomberNight
9310e9023e test_lnpeer: add test: multihop payment that routes around failure
This would have caught the overpayment bug fixed in
693583edc5
2021-03-02 18:35:07 +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
ThomasV
259dacd56f Trampoline MPP aggregation:
- trampoline node is the final recipient of MPP
 - each trampoline receives a bucket of HTLCs
 - if a HTLC from a bucket fails, wait for the entire bucket to fail
 - move trampoline route and onion code into trampoline module
2021-03-02 14:28:15 +01:00
ThomasV
693583edc5 lnworker: amount passed in HtlcLog must be without fees 2021-03-02 10:23:30 +01:00
SomberNight
2b693d3498 tests: fix test_lnpeer.test_payment_race
broke in b6b13217b4
see changes to lnworker.htlc_fulfilled
2021-02-28 13:58:31 +01:00
ThomasV
5175a97671 test_payment_race: increase delay 2021-02-28 09:43:46 +01:00
ThomasV
38652cffb0 fix test_lnpeer (follow-up prev commit) 2021-02-27 20:51:19 +01:00
ThomasV
b6b13217b4 lnworker: keep invoice status INFLIGHT as long as HTLCs are inflight 2021-02-27 20:26:58 +01:00
ThomasV
7f61f22857 MPP receive: allow payer to retry after mpp timeout 2021-02-27 11:48:14 +01:00
SomberNight
691ebaf4f8 lnworker/lnpeer: add some type hints, force some kwargs 2021-02-24 20:03:12 +01:00
ThomasV
6922b416d6 follow-up prev commit 2021-02-22 15:38:19 +01:00
bitromortac
e9fe0ed22b lnworker: use suggest_splits for multiple routes 2021-02-22 11:25:01 +01:00
bitromortac
9f84fa9580 lnonion: add total_msat to onion payment data 2021-02-22 11:25:00 +01:00
ThomasV
42c10c2fec Separate pay_to_node logic from pay_invoice:
- pay_to_node will be needed to forward trampoline onions.
 - pay_to_node either is successful or raises
 - pay_invoice handles invoice status
2021-02-07 13:03:18 +01:00
ThomasV
0c93394513 rename lnworker._pay to pay_invoice, call it directly from GUIs 2021-02-07 12:09:37 +01:00
ThomasV
34734bd229 cleanup, follow-up f28a2aae73 2021-02-05 17:09:47 +01:00
ThomasV
f28a2aae73 Reorganize code so that we can send Multi Part Payments:
- LNWorker is notified about htlc events and creates payment events.
 - LNWorker._pay is a while loop that calls create_routes_from_invoice.
 - create_route_from_invoices should decide whether to split the payment,
   using graph knowledge and feedback from previous attempts (not in this commit)
 - data structures for payment logs are simplified into a single type, HtlcLog
2021-02-05 14:28:58 +01:00
ThomasV
1102ea50e8 fix tests (follow-up previous commit) 2021-02-05 11:57:19 +01:00
ThomasV
ef5a265449 basic_mpp: receive multi-part payments 2021-02-04 16:31:17 +01:00
ThomasV
e477a43385 PaymentInfo: use msat precision 2021-02-01 15:03:56 +01:00
SomberNight
e8a2fa5596 tests: lnpeer.htlc_switch: don't fulfill htlc until add is irrevocable
This adds a failing test, where the HTLC switch fulfills an HTLC too soon,
before the corresponding 'update_add_htlc' is irrevocably committed.
2021-01-28 20:00:48 +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
805c5a2120 upfront_shutdown_script: rm dead code, fix test 2021-01-11 12:30:49 +01:00
bitromortac
e555ea650e lnpeer: add unit test for upfront shutdown script 2021-01-11 11:37:14 +01:00
ghost43
3eba26b398 LN cooperative close: avoid address-reuse (#6590)
Previously if we coop-closed multiple channels in the same session,
they would reuse the wallet address.
2020-09-15 15:37:47 +00:00
SomberNight
d5f368c584 LN invoices: support msat precision
fixes #6250
2020-06-22 22:48:13 +02:00
ThomasV
2adbbee5fe Add extra state to distinguish shutdown negotiation from post-
negotiation, where channel should not be reestablished. See #6182
2020-05-29 18:00:52 +02:00
SomberNight
f9de6a5354 tests: lnpeer: make debug htlc failure hooks more uniform 2020-05-14 19:15:32 +02:00
SomberNight
619f8555f5 follow-up prev: trivial rename
Just realised that the "diamond" graph is actually defined in Graph Theory
but it has an extra edge. What we have here is apparently called a "square" graph.
Not that it matters much but might as well name it as such then...
2020-05-06 11:27:50 +02:00
SomberNight
cc4029c335 test_lnpeer: add some multi-hop payment unit tests 2020-05-06 11:06:44 +02:00
SomberNight
04d018cd0f test_lnpeer: some clean-up, make it easier to add "num_node>2" tests 2020-05-06 11:06:33 +02:00
ThomasV
5c05c06bf0 follow-up prev commit: fix test_lnpeer 2020-05-05 21:18:17 +02:00
SomberNight
6f7a4ab048 lnpeer: add get_channel_by_id, for small speed-up 2020-04-30 21:13:29 +02:00
SomberNight
b9b53e7f76 lnworker: fix threading issues for .channels attribute
external code (commands/gui) did not always take lock when iterating lnworker.channels.
instead of exposing lock, let's take a copy internally (as with .peers)
2020-04-30 21:08:26 +02:00
SomberNight
b5811e8072 lnworker.peers: fix threading issues 2020-04-15 21:43:58 +02:00
SomberNight
1600241b02 fix tests: follow-up prev few commits 2020-04-15 17:39:39 +02:00
ThomasV
ef2ff11926 fix tests (follow-up prev commit) 2020-04-14 18:35:50 +02:00
SomberNight
54e1520ee4 ln: check if chain tip is stale when receiving HTLC
if so, don't release preimage / don't forward HTLC
2020-04-13 17:04:27 +02:00
SomberNight
12283d625b (trivial) rename lnchannel.channel_states to ChannelState 2020-04-13 16:02:05 +02:00
ThomasV
e50f6d29ed export channel backup from kivy gui 2020-04-10 20:04:24 +02:00
SomberNight
7dabbdd082 tests_lnpeer: trivial fix 2020-04-08 13:18:56 +02:00
ThomasV
d2a58a2ec3 lnpeer: do not assume our privkey is the same as lnworker's privkey. 2020-04-06 19:06:27 +02:00
SomberNight
1be0a710c3 ln: implement option payment_secret 2020-04-01 21:49:12 +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
c69937395e lnmsg: add more tests (for encode_msg, decode_msg) 2020-04-01 21:40:13 +02:00