Commit Graph

550 Commits

Author SHA1 Message Date
ThomasV 8a051dcd76 lnworker: use booleans for enable_htlc_settle, enable_htlc_forwarding 2021-03-18 07:48:30 +01:00
ThomasV e954bfaa54 request_force_close: close and reopen existing peer connection,
because channel_reestablish cannot be sent twice in the same session
2021-03-17 15:36:21 +01:00
ThomasV 1c8c236933 channels_with_funds: self._channels -> self.channels 2021-03-17 13:50:57 +01:00
ThomasV 8d8f078544 Merge pull request #7107 from bitromortac/2103-trampoline-mpp-single
mpp_split: use single nodes for mpp payments over trampoline
2021-03-17 13:47:13 +01:00
ThomasV 3c9838d999 lnworker: merge request_force_close and request_remote_force_close 2021-03-17 09:15:40 +01:00
bitromortac 8828998093 mpp_split: use single nodes for mpp payments over trampoline 2021-03-17 08:22:19 +01:00
SomberNight 5e12f88be3 lnworker: minor clean-up, fix typo 2021-03-16 19:19:26 +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
ThomasV bcfcc20363 fix: add request_force_close method 2021-03-16 17:27:37 +01:00
SomberNight dca182992f ln gossip: run sig checks in a thread
to avoid blocking the asyncio event loop
2021-03-15 20:44:24 +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 ea56a259e4 lnworker: (trivial) split handle_error_code_from_failed_htlc method 2021-03-15 20:44:16 +01:00
ThomasV 018f09f2af use mktx_for_open_channel in commands module. fix indentation 2021-03-12 19:05:25 +01:00
ThomasV 1a4e55a911 follow-up 90b228de83 2021-03-12 16:38:48 +01:00
ThomasV 8984db3384 follow-up 90b228de83 2021-03-12 16:28:56 +01:00
ThomasV bed4ddbcb4 fix dict value assignment bug in import_channel_backup. In request_force_close, use Taskgroup with wait=any 2021-03-12 16:09:24 +01:00
ThomasV 90b228de83 fix wallet get_full_history: add onchain tx for channels not opened by us 2021-03-12 12:15:39 +01:00
SomberNight 2487a3fa90 tests: add test for prev 2021-03-11 20:35:21 +01:00
SomberNight cb78f73ed0 lnworker: try to fail pending HTLCs when shutting down
This is most useful when receiving MPP where there is a non-trivial chance
that we have received some HTLCs for a payment but not all, and the user
closes the program. We try to fail them and wait for the fails to get
ACKed, with a timeout of course.
2021-03-11 19:31:22 +01:00
ThomasV 533d796a41 add TODO, rename check_received_mpp_htlc 2021-03-11 16:53:55 +01:00
ThomasV 549b9a95df test_lnpeer: add test for mpp_timeout 2021-03-10 17:09:07 +01:00
ThomasV 7ae82c8230 Revert "lnworker: simplify request_force_close_from_backup"
This reverts commit ce88b36e81.
2021-03-10 12:54:00 +01:00
SomberNight 3c019c2f9c daemon/wallet/network: make stop() methods async 2021-03-09 17:52:36 +01:00
ThomasV ce88b36e81 lnworker: simplify request_force_close_from_backup 2021-03-09 12:28:25 +01:00
ThomasV 652d10aa5f Remove LNBackups object: no longer needed since LNWorker is instantiated by default. 2021-03-09 11:52:04 +01:00
ThomasV ef661050c8 lnworker: set request status after LN payment 2021-03-09 09:35:43 +01:00
SomberNight a125cd5392 tests: test payreq status after getting paid via LN
The test failures corresponding to single-part (non-MPP) payments expose a bug.

see https://github.com/spesmilo/electrum/blob/196b4c00a35b288f28885c0ceb8afdd5ffbd9a0f/electrum/lnpeer.py#L1538-L1539
`lnworker.add_received_htlc` is not called for single-part payments...
2021-03-08 22:18:06 +01:00
SomberNight 4069b455d0 lnaddr: add get_features method 2021-03-08 21:36:27 +01:00
ThomasV 196b4c00a3 Use new value of option_trampoline_routing flag, add it to our invoices.
Keep supporting old value for Eclair/Phoenix.
Do not add trampoline_routing_hints in invoices.
2021-03-08 19:16:48 +01:00
ThomasV fd48b96335 follow-up prev commit 2021-03-08 17:45:00 +01:00
ThomasV 308b02ca7d lnworker: fix amount in htlc_log after mpp bucket failure 2021-03-08 17:23:52 +01:00
ThomasV 5df4466812 rm fixme; it was for intermediate stage, between commits. 2021-03-08 13:30:59 +01:00
SomberNight edb214aeca lnworker.pay_to_node: re overpayment, raise before actually it happens 2021-03-06 14:23:00 +01:00
ThomasV 5663e59863 lnworker: fix amount_inflight.
(amount with routing fees were used on htlc failures)
2021-03-06 10:46:40 +01:00
ThomasV 31919d0425 lnworker: add assert amount_inflight <= amount_to_pay 2021-03-06 00:29:37 +01:00
ThomasV 5207c40cc3 fix trampoline forwarding: add_received_htlc must be indexed by payment_secret 2021-03-05 17:04:26 +01:00
ThomasV 2e4f45ec74 use two trampolines: fix blacklisting, use local variables for trampoline_fee_level and use_two_trampolines 2021-03-05 10:07:02 +01:00
ThomasV 5a2a724cb9 Receive MPP: Use persisted payment status to decide whether to
fulfill HTLCs. Without this commit, we might timeout a part of
a payment if the client is shut down before all parts are
fulfilled.
2021-03-04 14:11:55 +01:00
ThomasV 738411e32b Trampoline forwarding:
- fix regression in create_routes:
   fwd_trampoline_onion was not added to the tuple
 - fix onion structure for e2e
 - maybe_fulfill_htlc:
   check the mpp_status of the outer onion,
   return trampoline_onion to be forwarded
2021-03-04 11:46:31 +01:00
ThomasV ba4d6bc8b3 trampoline MPP: fix total_msat in trampoline onion, and bucketing 2021-03-04 10:05:09 +01:00
ThomasV 253907fb60 lnworker: move buckets logic inside first branch of if statement (refactoring commit) 2021-03-04 08:50:22 +01:00
SomberNight adbfb2dcc8 lnworker.pay_to_node: (fix) pass correct total_msat to pay_to_route 2021-03-03 20:35:48 +01:00
ThomasV ca6ecd56f2 fix route for non-trampoline MPP 2021-03-03 12:30:29 +01:00
ThomasV 51f3c613a5 (minor) fix typos and indentation 2021-03-03 10:03:29 +01:00
SomberNight 9310e9023e test_lnpeer: add test: multihop payment that routes around failure
This would have caught the overpayment bug fixed in
https://github.com/spesmilo/electrum/commit/693583edc5010ece804e312626c7c40157613ff1
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 06ea06f7d3 _calc_routing_hints_for_invoice: incl max 15 chans to avoid qr overflow
Prioritise channels that are likely to be able to receive the payment.
2021-03-01 21:55:41 +01:00
SomberNight 6f894b9f88 _calc_routing_hints_for_invoice: also incl chans < invoice amount
now that we can receive MPP
2021-03-01 21:51:17 +01:00