1
0
Commit Graph

35 Commits

Author SHA1 Message Date
ThomasV
40c08d350f trampoline: fix two bugs preventing legacy payments to
Electrum clients that have non-trampoline channels.

 - if an invoice supports trampoline, but provides only
non-trampoline nodes in its routing hints, we must use
a legacy trampoline payment

 - when we create a trampoline onion for a legacy payment,
the invoice_features field is a u64, so we need to remove
high feature bits.
2023-08-27 11:48:29 +02:00
SomberNight
a3997f8b58 lnworker: don't create invoice with dupl t-hints, & filter when sending
- when creating an invoice, if we had multiple chans with the same trampoline,
  were putting duplicate t-hints into the invoice
- when paying an invoice that had duplicate t-hints, we would sometimes
  construct invalid paths (SRC>T1->T1->DST)
2023-08-17 20:04:02 +00:00
SomberNight
98bea49a3c lnworker.pay_to_node: make trampoline fee_level and failed_routes local
multiple instances of pay_to_node might run concurrently, esp for trampoline forwarding
2023-08-11 22:01:11 +00:00
SomberNight
fc6486ecdb lnaddr: make payment_secret field mandatory, in both directions
we now require payment_secret both for sending and for receiving
(previously was optional for both)

see
https://github.com/lightning/bolts/pull/898
https://github.com/ACINQ/eclair/pull/1810
https://github.com/ElementsProject/lightning/pull/4646

note: payment_secret depends on var_onion_optin, so that becomes mandatory as well,
however this commit does not yet remove the ability of creating legacy onions
2023-06-29 14:34:02 +00:00
ThomasV
d95f3e5622 Use different trampoline bits than Eclair. Fixes #8141 2023-01-13 12:48:13 +01:00
ThomasV
552300dc89 follow-up previous commit 2022-09-29 12:13:22 +02:00
ThomasV
4366055ada Remove old trampoline compatibility bits from invoices
bits 50/51 are now used on the network (as option_zeroconf)
2022-09-29 12:06:49 +02:00
ThomasV
68bf714ae6 Trampoline: Remember failed routes (fixes #7967).
Upon receiving UNKNOWN_NEXT_PEER, TEMPORARY_NODE_FAILURE
or TEMPORARY_CHANNEL_FAILURE, remember the trampoline route
that was used, and try other routes before raising the
trampoline fee.

Before this commit, we used to raise the trampoline fee
upon receiving any error message, in order to ensure
termination of the payment loop.

Note that we will still retry failing routes after we have
raised the trampoline fee. This choice is questionable, it
is unclear if doing so significantly increases the probability
of success.

Tests: add a test for trampoline handling of UNKNOWN_NEXT_PEER
2022-09-19 16:42:46 +02:00
ThomasV
082a50f2bd trampolines_by_id must return dict (follow-up previous commit) 2022-09-07 17:48:13 +02:00
ThomasV
99c4c75c9d hardcoded trampolines: do not mix testnet nodes and unitests.
(This was added in 3a7f5373ac. Not sure what the reason is, but
it triggers UNKNOWN_NEXT_PEER errors, that in turn affect routing
choices, e.g. fallback to single trampoline route)
2022-09-07 17:17:13 +02:00
ThomasV
92b21df843 Trampoline: if possible, do not add second trampoline for e2e payments.
This should fix #7967
2022-09-04 09:39:42 +02:00
ThomasV
c6f940d092 trampoline: less verbose, do not log routes that are not tried 2022-09-03 18:24:58 +02:00
ThomasV
7d9f20f8ab update trampoline feature bits. fixes #7801 2022-07-05 08:48:34 +02:00
bitromortac
a4f5cfc91a trampoline: refactor routes, enable e2e mpp
* Refactor `create_trampoline_route`.
* Enables end-to-end multi-trampoline multipart payments.
  Trampoline-to-legacy payments are still not enabled, as this is
  currently not supported by Eclair.
* Reverts to a global trampoline fee level, as trampoline failures
  are currently not handled properly, see (#7648), which doubles
  fee rates.
2022-02-18 10:14:51 +01:00
bitromortac
8ed0f58277 trampoline: add electrum testnet node 2022-02-18 10:14:51 +01:00
bitromortac
a3ec3f3228 trampoline: forwarding, use correct secret for legacy case 2021-12-20 16:45:15 +01:00
bitromortac
58dd8996fb trampoline: use trampoline policy for intermediate forwarders 2021-12-20 16:45:15 +01:00
ghost43
ce44a03c24 Merge pull request #7202 from bitromortac/2104-mpp-channel-splitting
MPP splitting algorithm: redesign and split within channels
2021-12-17 13:58:54 +00:00
wakiyamap
de596a6bfa Change lightning node(signet) 2021-08-12 17:13:28 +09:00
bitromortac
68bc9c2474 lnworker: improve route creation
- Separates the trampoline and local routing multi-part payment cases.
- Ask only for splits that don't send over a single channel (those have
  been tried already in the single-part case).
- Makes sure that create_routes_for_payment only yields partial routes
  that belong to a single split configuration.
- Tracks trampoline fee levels on a per node basis, previously, in the
  case of having two channels with a trampoline forwarder, the global
  fee level would have increased by two levels upon first try.
2021-07-16 11:27:36 +02:00
SomberNight
04bc7fd28f trampoline: fix "pay-to-legacy" workaround when using ACINQ node
It is the last Trampoline Forwarder that should be checked, not the
first one.

Consider route (of Trampolines only):
Alice-electrum -> T_ACINQ -> T_Hodlister -> Bob-electrum
Even if Bob has a transport open with ACINQ or even if Bob has a channel open with ACINQ,
Alice can safely use end-to-end trampoline for this route: ACINQ will not know who
the recipient is, so they will not try to do pay-to-open (and hold up the payment for minutes...).

related: https://github.com/ACINQ/lightning-kmp/pull/237
2021-07-02 19:42:58 +02:00
SomberNight
3a7f5373ac trampoline: improve payment success
- better error handling: previously we stopped all attempts on any of
  TRAMPOLINE_EXPIRY_TOO_SOON, UNKNOWN_NEXT_PEER, TEMPORARY_NODE_FAILURE.
  Instead we should retry (but see code comments).
- previously payments failed if ALL of the following criteria applied:
  - sender is paying via trampoline, but not via the ACINQ node (which is
    special cased)
  - receiver only has private channels and has put r_tags into invoice, along
    with setting the trampoline feature bit in the invoice, however the receiver
    is not connected to any trampoline forwarders directly
  The sender would then assume that the private routing hints in the invoice
  correspond to trampoline forwarders.
- also, previously if both the sender and the recipient used trampoline and
  they shared a trampoline forwarder (that they were both connected to), the
  private channels the recipient had (with nodes other than the shared TF)
  would never be attempted.
2021-07-02 18:44:39 +02:00
wakiyamap
639cd94dcb add signet support 2021-05-06 19:47:22 +09:00
ThomasV
03a95f36fc add trampoline.hodlister.co 2021-03-28 06:05:04 +02:00
ThomasV
bdd9c4823f hardcoded trampoline nodes: replace IPs with domain names 2021-03-26 15:49:10 +01:00
ThomasV
c3221f7bfe (temporary) disable e2e and dual trampoline if first trampoline is ACINQ 2021-03-22 16:23:01 +01:00
Benoit Verret
f731c38293 Minor style changes 2021-03-21 00:36:23 -04: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
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
16554afa1b follow-up previous commit (this was for testing) 2021-03-05 10:14: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
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
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