Commit graph

3556 commits

Author SHA1 Message Date
Matt Corallo
f6fa8e9c5b
Merge pull request #1370 from TheBlueMatt/2022-03-pref-first-hop-chans
Avoid needless MPP on multiple channels to the same first-hop
2022-03-23 22:44:37 +00:00
Matt Corallo
fcfd683312
Merge pull request #1360 from tnull/2022-03-loopless-random-walks
Avoid looping CLTV shadow routes.
2022-03-23 21:40:25 +00:00
Matt Corallo
b010aeb5f1
Merge pull request #1326 from Psycho-Pirate/peers
Added option to send remote IP to peers
2022-03-23 21:02:17 +00:00
Matt Corallo
b1bc07802e Avoid needless MPP on multiple channels to the same first-hop
When we have many channels to the same first-hop, many of which do
not have sufficient balance to make the requested payment, but when
some do, instead of simply using the available channel balance we
may switch to MPP, potentially with many, many paths.

Instead, we should seek to use the smallest channel which can
easily handle the requested payment, which we do here by sorting
the first_hops in our router before beginning the graph search.

Note that the "real" fix for this should be to instead decide which
channel to use at HTLC-send time, as most other nodes do during
relay, but this provides a minimal fix without needing to do the
rather-large work of refactoring our HTLC send+relay pipelines.

Issues with overly-aggressive MPP on many channels were reported by
Cash App.
2022-03-23 21:01:49 +00:00
Elias Rohrer
11c3120309 Avoid looping CLTV shadow routes. 2022-03-23 12:21:48 -06:00
Matt Corallo
cb1d795559
Merge pull request #1374 from TheBlueMatt/2022-03-bindings-cleanups
Trivial Bindings Cleanups
2022-03-23 00:46:31 +00:00
psycho-pirate
fc2f793d19 Argument added in lightning-net-tokio/src/lib.rs and comments updated 2022-03-23 04:44:28 +05:30
psycho-pirate
20a81e5c14 added network address in methods, filter_address function with tests and updated documentation 2022-03-23 04:44:28 +05:30
valentinewallace
74b9c1aa4e
Merge pull request #1353 from dunxen/2022-03-mpp-receive-timeout
Add MPP receive timeout handling
2022-03-22 17:15:18 -04:00
valentinewallace
a584901aad
Merge pull request #1373 from lightningdevkit/dependabot/github_actions/actions/cache-3
Bump actions/cache from 2 to 3
2022-03-22 16:39:57 -04:00
Matt Corallo
3920157765
Merge pull request #1368 from TheBlueMatt/2022-03-fix-post-start-sync
Send a gossip_timestamp_filter on connect to enable gossip sync
2022-03-22 19:23:51 +00:00
Duncan Dean
4086ce8149
Add MPP receive timeout handling 2022-03-22 20:06:42 +02:00
Matt Corallo
996d3d8058
Merge pull request #1352 from TheBlueMatt/2022-03-debug-rwlock
Implement lockorder checking on RwLocks in debug_sync
2022-03-22 04:19:12 +00:00
Matt Corallo
5588f2fa5d Use impl<bounds> instead of a where clause to help bindings 2022-03-21 20:09:30 +00:00
Matt Corallo
ad19d35a09 Tag some type aliases with (C-not exported)
Type aliases are now more robustly being exported in the C bindings
generator, which requires ensuring we don't include some type
aliases which make no sense in bindings.
2022-03-21 20:09:30 +00:00
dependabot[bot]
e418bdff76
Bump actions/cache from 2 to 3
Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-21 17:38:00 +00:00
Matt Corallo
5ed2985cae
Merge pull request #1361 from luizParreira/rust-lightning/issues/1280
Create normal/phantom invoice with description hash
2022-03-18 20:29:23 +00:00
Matt Corallo
35c8718185 Use the term "lock" for Mutex/RwLock instead of "mutex" 2022-03-18 18:54:27 +00:00
Matt Corallo
3648784f81 Implement lockorder checking on RwLocks in debug_sync 2022-03-18 18:54:27 +00:00
Luiz Parreira
7714393cf0
Create normal/phantom invoice with description hash 2022-03-18 15:08:00 -03:00
Matt Corallo
2af3413b35
Merge pull request #1363 from TheBlueMatt/2022-03-tx-conf-ordering-lock-delay
Generate a funding_locked on relevant transactions_confirmed calls
2022-03-18 17:20:53 +00:00
Matt Corallo
3cca221f8b Send a gossip_timestamp_filter on connect to enable gossip sync
On connection, if our peer supports gossip queries, and we never
send a `gossip_timestamp_filter`, our peer is supposed to never
send us gossip outside of explicit queries. Thus, we'll end up
always having stale gossip information after the first few
connections we make to peers.

The solution is to send a dummy `gossip_timestamp_filter`
immediately after connecting to peers.
2022-03-17 22:18:33 +00:00
Matt Corallo
b1fb7fdb9b Rename RoutingMessageHandler::sync_routing_table peer_connected
Its somewhat strange to have a trait method which is named after
the intended action, rather than the action that occurred, leaving
it up to the implementor what action they want to take.
2022-03-17 22:04:48 +00:00
Matt Corallo
c244c781f6
Merge pull request #1358 from TheBlueMatt/2022-03-max-cltv
Make `max_total_cltv_expiry_delta` include the final CLTV
2022-03-17 05:13:56 +00:00
Matt Corallo
bb4413cc65 Make max_total_cltv_expiry_delta include the final CLTV
This fixes an integer underflow found by the `router` fuzz target
in CI.
2022-03-16 22:10:46 +00:00
Matt Corallo
fef8acf70c Make routing benchmark robust against path changes
If the scoring in the routing benchmark causes us to take a
different path from the original scan, we may end up deciding that
the only path to a node has a too-high total CLTV delta, causing us
to panic in the benchmarking phase.

Here we simply check for that possibility and remove paths that
fail post-scoring.
2022-03-16 22:10:46 +00:00
Matt Corallo
699ac8390a
Merge pull request #1325 from ViktorTigerstrom/2022-02-filter-route-hints
Filter route hints when creating invoices
2022-03-16 17:32:40 +00:00
Viktor Tigerström
ff792e05bb Add phantom invoice route hints filtering tests 2022-03-16 11:24:12 +01:00
Viktor Tigerström
43cc81c893 Filter route hints for phantom invoices
Filter the route hints in `create_phantom_invoice` based on the
following criteria:

* Only one channel for every counterparty node per phantom
payment-receiving node in the invoice
* Always select the channel with the highest inbound capacity
* For each payment-receiving node, filter out channels with a lower
inbound capacity than the invoice amount, if any channel exists with
enough capacity to cover the invoice amount
* If any public channels exists for a payment-receiving node, push a
single RouteHintHop with the phantom route and let the sender find the
path to the payment-receiving node through the public channels.
2022-03-16 11:24:12 +01:00
Viktor Tigerström
eae5086b8d Add tests for create invoice route hints filtering 2022-03-16 11:24:12 +01:00
Viktor Tigerström
fe49fbd7b8 Filter route hints for create invoice
Filter the route hints in `create_invoice_from_channelmanager` based on
the following criteria:

* Only one channel per counterparty node
* Always select the channel with the highest inbound capacity
* Filter out channels with a lower inbound capacity than the invoice
amount, if any channel exists with enough capacity to cover the invoice
amount
* If any public channel exists, the invoice route_hints should be empty,
and the sender will need to find the path to the payment-receiving node
by looking at the public channels instead
2022-03-16 11:24:12 +01:00
Matt Corallo
ea769427fe Generate a funding_locked on relevant transactions_confirmed calls
Previously, if we were offline when a funding transaction was
locked in, and then we came back online, calling
`best_block_updated` once followed by `transactions_confirmed`,
we'd not generate a funding_locked until the next
`best_block_updated`.

We address this by re-calling `best_block_updated` in
`transactions_confirmed`, similar to how `ChannelMonitor` works.
2022-03-15 23:59:35 +00:00
Jeffrey Czyz
ca163c3fae
Merge pull request #1331 from TheBlueMatt/2022-02-no-copy-invoice-fields
Use &mut self in invoice updaters, not take-self-return-Self
2022-03-11 14:26:02 -06:00
Matt Corallo
b1cd5a7434
Merge pull request #1311 from TheBlueMatt/2022-02-0conf-part-1
Support for SCID Aliases
2022-03-10 00:47:23 +00:00
valentinewallace
756bcbc667
Merge pull request #1341 from jkczyz/2022-03-expiry-time-panic
Correct docs about invoice_expiry_delta_secs panic
2022-03-09 18:19:22 -05:00
Jeffrey Czyz
e6024ab788
Merge pull request #1349 from TheBlueMatt/2022-03-listen-send-sync
Require `chain::Listen` impls in block sync be `Send + Sync`
2022-03-09 16:41:40 -06:00
Matt Corallo
2bba1d4251
Merge pull request #1348 from TheBlueMatt/2022-03-timer-tick-count
Reduce the number of timer ticks a peer is allowed to take
2022-03-09 21:28:05 +00:00
Matt Corallo
eafe7d2e24
Merge pull request #1355 from lightningdevkit/dependabot/cargo/lightning/regex-0.2.11
Update regex requirement from 0.1.80 to 0.2.11 in /lightning
2022-03-09 21:27:50 +00:00
Jeffrey Czyz
f1a6469a0a
Correct docs about invoice_expiry_delta_secs panic 2022-03-09 14:39:31 -06:00
Matt Corallo
e4486fe9f4 Support receiving multiple funding_locked messages
As a part of adding SCID aliases to channels, we now have to accept
otherwise-redundant funding_locked messages which serve only to
update the SCID alias. Previously, we'd failt he channel as such
an update used to be bogus.
2022-03-09 19:14:39 +00:00
Matt Corallo
84fa127661 Provide our peers with SCID aliases and forward payments with them
This creates an SCID alias for all of our outbound channels, which
we send to our counterparties as a part of the `funding_locked`
message and then recognize in any HTLC forwarding instructions.

Note that we generate an SCID alias for all channels, including
already open ones, even though we currently have no way of
communicating to our peers the SCID alias for already-open
channels.
2022-03-09 19:14:39 +00:00
Matt Corallo
10be993f94 Handle short_to_id state updates on channel closure via macros
This avoids needing to update channel closure code in many places
as we add multiple SCIDs for each channel and have to track them.
2022-03-09 19:14:38 +00:00
Matt Corallo
b2629afd88 Track SCID aliases from our counterparty and use them in invoices
New `funding_locked` messages can include SCID aliases which our
counterparty will recognize as "ours" for the purposes of relaying
transactions to us. This avoids telling the world about our
on-chain transactions every time we want to receive a payment, and
will allow for receiving payments before the funding transaction
appears on-chain.

Here we store the new SCID aliases and use them in invoices instead
of he "standard" SCIDs.
2022-03-09 19:14:38 +00:00
Matt Corallo
f54ebf78f6 Add support for deserializing the new SCID alias in funding_locked 2022-03-09 19:14:38 +00:00
Matt Corallo
a274261c59 Clean up the handle_monitor_err!() macro argument forms somewhat
`handle_monitor_err!()` has a number of different forms depending
on which messages and actions were outstanding when the monitor
updating first failed. Instead of matching by argument count, its
much more readable to put an explicit string in the arguments to
make it easy to scan for the called form.
2022-03-09 19:14:38 +00:00
Jeffrey Czyz
a50e9549b4
Merge pull request #1286 from tnull/add_random_cltv_offsets
Add random 'shadow route' CLTV delta offsets to improve privacy
2022-03-09 13:08:57 -06:00
Matt Corallo
84a08dbf8a Make lightning-block-sync's init module slightly more generic
Users who want to use lightning-block-sync's init module would
be reasonable in wanting to use it in a multithreaded environment,
however because it takes a list of listeners as dyn chain::Listen
without any Send or Sync bound they fail in doing so.

Here we make the type bounds on `chain::Listen` generic across
`chain::Listen + ?Sized`, which the existing bound of `&dyn
chain::Listen` satisfies. Thus, this is strictly less restrictive
and allows for the use of `&dyn chain::Listen + Send + Sync`.
2022-03-09 18:20:43 +00:00
dependabot[bot]
ca96bb7fb6
Update regex requirement from 0.1.80 to 0.2.11 in /lightning
Updates the requirements on [regex](https://github.com/rust-lang/regex) to permit the latest version.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/0.1.80...0.2.11)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-09 17:38:53 +00:00
Elias Rohrer
e92b5a7ebd Add a random per-path CLTV offset for privacy. 2022-03-09 11:13:47 -06:00
Jeffrey Czyz
1a734492d9
Merge pull request #1347 from jkczyz/2022-03-log-approximation
Use log approximation in ProbabilisticScorer
2022-03-09 10:19:25 -06:00