Commit graph

1861 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
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
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
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
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
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
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
Matt Corallo
82bbb807ad Refactor debug sync methods into helper functions 2022-03-09 06:23:39 +00:00
Jeffrey Czyz
d70292d6c8
Fix compilation warnings with --features=no-std 2022-03-08 23:23:25 -06:00
Jeffrey Czyz
7f83c559b4
Use log approximation in ProbabilisticScorer
Since f64::log10 exists in std but not core, unconditionally use log
approximation so --feature=no-std will compile.
2022-03-08 23:22:38 -06:00
Matt Corallo
09f8abad93 Move private channel and short-conf tests to new module 2022-03-08 19:16:17 +00:00
Matt Corallo
3fe76e61a3 Add a new functional test utility to open an unannounced channel 2022-03-08 19:16:17 +00:00
Matt Corallo
a9c4e70213 Give ChannelManagers channel_udpates for pub chans in test
This makes tests slightly more realistic by delivering
`channel_update`s to `ChannelManager`s, ensuring we have
forwarding data stored locally for all channels, including public
ones.
2022-03-08 19:16:17 +00:00
Matt Corallo
252280d6bf Reduce the number of timer ticks a peer is allowed to take
In 2d3a210897, we increased the
default ping timer in `lightning-background-processor` to ten
seconds from five. However, we didn't change the timer count at
which we disconnect peers if they're not responding, which we
likely should have done. We do so here, as well as update the
documentation for `PeerManager::timer_tick_occurred` to suggest
always ticking the timer every ten seconds instead of five.
2022-03-07 19:07:14 +00:00
Matt Corallo
0e0aabea07
Merge pull request #1317 from TheBlueMatt/2022-02-fix-bunk-test
Fix what `bolt2_open_channel_sending_node_checks_part1` tests
2022-03-05 20:54:57 +00:00
Matt Corallo
6e776d9fb9 Clean up TestKeysInterface random bytes override interface
Its very confusing to have multiple fields that do the same thing,
one of which isn't even used for its stated purpose anymore after
the previous few commits.
2022-03-04 21:54:32 +00:00
Matt Corallo
010c34f351 Fix what bolt2_open_channel_sending_node_checks_part1 tests
There are currently two issues with
`bolt2_open_channel_sending_node_checks_part1` which counteract
each other and hide that the test isn't testing what it should be.

First of all, the final `create_channel` call actually fails
because we try to open a channel with ourselves, instead of
panicing as the test is supposed to check for.

However, when we fix the create_channel call to panic, when we
drop `nodes[1]` after `create_channel` panics, we fail the
no-pending-messages test as it as an expeted `accept_channel` in
its outbound buffer. This causes a double-panic.

Previously, these two offset each other - instead of panicing in
`create_channel` we'd panic in the Node drop checks.

This fixes both by fetching the `accept_channel` before we go into
the panic'ing `create_channel` call (who's arguments were
		corrected).
2022-03-04 21:54:21 +00:00
Matt Corallo
60f7977ea8 Add Clone to a few structs which contain only a few fields
Specifically, `PhantomRouteHints`, `FixedPenaltyScorer`, and
`ScoringParamters`.
2022-03-03 18:10:59 +00:00
Matt Corallo
f9983de485 Merge branch '2022-02-bal-panic' into 2022-02-0.0.105-sec 2022-03-01 02:23:14 +00:00