Commit graph

3367 commits

Author SHA1 Message Date
Matt Corallo
77cab14a7a
Merge pull request #1382 from TheBlueMatt/2022-03-gossip-queries-sucks
Fix gossip using `gossip_timestamp_filter` instead of queries
2022-03-25 19:49:37 +00:00
valentinewallace
eb50201ed5
Merge pull request #1381 from shamardy/2022-03-set-inbound-user-chan-id
Add `user_channel_id` to `accept_inbound_channel` method
2022-03-25 14:28:57 -04:00
Matt Corallo
1386a0c96b Fix gossip using gossip_timestamp_filter instead of queries
See large comment added for more details
2022-03-25 17:12:09 +00:00
Omar Shamardy
edd4babb1c set user_channel_id in accept_inbound_channel fn
fix docs

edit user_channel_id docs for Event::ChannelClosed

review fixes
2022-03-25 05:39:58 +02:00
Matt Corallo
216225c00b
Merge pull request #1359 from tnull/2022-03-real-random-shuffle
Randomize candidate paths during route selection.
2022-03-24 23:13:12 +00:00
Matt Corallo
4e89e5741b
Merge pull request #1380 from TheBlueMatt/2022-03-skip-redundant-sig-checks
Skip `channel_update` signature checks if we have a newer state
2022-03-24 22:51:17 +00:00
Matt Corallo
63ca72e5b0 Skip channel_update signature checks if we have a newer state
`channel_update` messages already have their signatures checked
with the network graph write lock held, so there's no reason to
check the signatures before doing other quicker checks first,
including checking if we're already aware of a newer update for the
channel.

This reduces common-case CPU usage as `channel_update`s are sent
rather liberally over the p2p network to gossip them.
2022-03-24 17:21:30 +00:00
valentinewallace
4455143525
Merge pull request #1058 from TheBlueMatt/2021-08-fail-claimed-dust-htlc
Add a further test of HTLC failure after a claim occurrs.
2022-03-24 13:01:56 -04:00
Elias Rohrer
ff7ec0c645 Minor refactor for sort / add, and some nits.
- `sort_by_key` to `sort_unstable_by_key`
- `checked_add() .. max_value()` to `saturating_add()`
- Some typos and nits
2022-03-24 09:12:44 -06:00
Elias Rohrer
b11dcf9ba8 Randomize candidate paths during route selection. 2022-03-24 09:12:26 -06:00
Matt Corallo
305a0d9ac5 Add a further test of HTLC failure after a claim occurrs.
This adds a further test of 7e78fa660c
which I had lying around in my TODO list for a while.
2022-03-24 00:55:26 +00:00
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