]> git.bitcoin.ninja Git - rust-lightning/log
rust-lightning
2 years agoAdd expiry to inbound payment util functions
Duncan Dean [Fri, 15 Apr 2022 12:57:34 +0000 (14:57 +0200)]
Add expiry to inbound payment util functions

2 years agoMerge pull request #1384 from valentinewallace/2022-03-chanmanless-phantom-invoices
Matt Corallo [Wed, 13 Apr 2022 14:51:35 +0000 (14:51 +0000)]
Merge pull request #1384 from valentinewallace/2022-03-chanmanless-phantom-invoices

2 years agoMerge pull request #1406 from TheBlueMatt/2022-04-scorer-precision
Matt Corallo [Wed, 13 Apr 2022 14:00:00 +0000 (14:00 +0000)]
Merge pull request #1406 from TheBlueMatt/2022-04-scorer-precision

[RFC] Expand the precision of our log10 lookup tables + add precision

2 years agoExpose methods for ChannelManager-less phantom invoice generation
Valentine Wallace [Thu, 24 Mar 2022 19:43:40 +0000 (15:43 -0400)]
Expose methods for ChannelManager-less phantom invoice generation

2 years agoMerge pull request #1412 from lightningdevkit/dependabot/github_actions/codecov/codec...
Jeffrey Czyz [Mon, 11 Apr 2022 22:16:06 +0000 (18:16 -0400)]
Merge pull request #1412 from lightningdevkit/dependabot/github_actions/codecov/codecov-action-3

Bump codecov/codecov-action from 2 to 3

2 years agoLower-bound the log approximation and stop using it > ~98.5% 2022-04-scorer-precision
Matt Corallo [Sun, 3 Apr 2022 21:21:54 +0000 (21:21 +0000)]
Lower-bound the log approximation and stop using it > ~98.5%

When we start getting a numerator and divisor particularly close to
each other, the log approximation starts to get very noisy. In
order to avoid applying scores that are basically noise (and can
range upwards of 2x the default per-hop penalty), simply consider
such cases as having a success probability of 100%.

2 years agoExpand the precision of our log10 lookup tables + add precision
Matt Corallo [Sun, 3 Apr 2022 20:16:03 +0000 (20:16 +0000)]
Expand the precision of our log10 lookup tables + add precision

When we send values over channels of rather substantial size, the
imprecision of our log lookup tables creates a rather substantial
non-linearity between values that round up or down one bit.

For example, with the default scoring values, sending 100k sats
over channels with 1m, 2m, 3m, and 4m sats of capacity score
rather drastically differently: 3645, 2512, 500, and 1442 msat.

Here we expand the precision of our log lookup tables rather
substantially by: (a) making the multiplier 2048 instead of 1024,
which still fits inside a u16, and (b) quadrupling the size of the
lookup table to look at the top 6 bits after the most-significant
bit of an input instead of the top 4.

This makes the scores of the same channels substantially more
linear, with values of 3613, 1977, 1474, and 1223 msat.

The same channels would be scored at 3611, 1972, 1464, and 1216
msat with a non-approximating scorer.

2 years agoMerge pull request #1307 from jkczyz/2022-02-block-source-self-ref
Matt Corallo [Sat, 9 Apr 2022 15:25:42 +0000 (15:25 +0000)]
Merge pull request #1307 from jkczyz/2022-02-block-source-self-ref

Immutable BlockSource interface

2 years agoBump codecov/codecov-action from 2 to 3
dependabot[bot] [Tue, 5 Apr 2022 17:32:54 +0000 (17:32 +0000)]
Bump codecov/codecov-action from 2 to 3

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2 to 3.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agoMerge pull request #1409 from TheBlueMatt/2022-04-bindings-invoice-ders
Matt Corallo [Mon, 4 Apr 2022 15:39:29 +0000 (15:39 +0000)]
Merge pull request #1409 from TheBlueMatt/2022-04-bindings-invoice-ders

Move lightning-invoice deser errors to lib.rs instead of `pub use`

2 years agoMove lightning-invoice deser errors to lib.rs instead of `pub use` 2022-04-bindings-invoice-ders
Matt Corallo [Mon, 4 Apr 2022 02:51:22 +0000 (02:51 +0000)]
Move lightning-invoice deser errors to lib.rs instead of `pub use`

Having public types in a private module is somewhat awkward from a
readability standpoint, but, more importantly, the bindings logic
has a relatively rough go of converting them - it doesn't implement
`pub use` as its "implement this function" logic is all within the
context of a module. We'd need to keep a set of re-exported things
to implement them when parsing modules...or we could just move two
enums from `de.rs` to `lib.rs` here, which is substantially less
work.

2 years agoImmutable BlockSource interface
Jeffrey Czyz [Mon, 14 Feb 2022 21:31:59 +0000 (15:31 -0600)]
Immutable BlockSource interface

Querying a BlockSource is a logically immutable operation. Use non-mut
references in its interface to reflect this, which allows for users to
hold multiple references if desired.

2 years agoAdd a test which demonstrates scores for some realistic payments
Matt Corallo [Sun, 3 Apr 2022 20:36:09 +0000 (20:36 +0000)]
Add a test which demonstrates scores for some realistic payments

2 years agoMerge pull request #1397 from jkczyz/2022-03-release-0.0.106 v0.0.106
Matt Corallo [Sun, 3 Apr 2022 16:31:54 +0000 (16:31 +0000)]
Merge pull request #1397 from jkczyz/2022-03-release-0.0.106

Cut 0.0.106

2 years agoBump crate versions to 0.0.106/invoice 0.14
Jeffrey Czyz [Wed, 30 Mar 2022 17:08:26 +0000 (12:08 -0500)]
Bump crate versions to 0.0.106/invoice 0.14

2 years agoUpdate CHANGELOG for 0.0.106
Jeffrey Czyz [Wed, 30 Mar 2022 04:58:50 +0000 (23:58 -0500)]
Update CHANGELOG for 0.0.106

2 years agoMerge pull request #1399 from jkczyz/2022-03-scoring-tweaks
Matt Corallo [Sat, 2 Apr 2022 01:50:55 +0000 (01:50 +0000)]
Merge pull request #1399 from jkczyz/2022-03-scoring-tweaks

ProbabilisticScorer improvements

2 years agoAdd an amount penalty to ProbabilisticScorer
Jeffrey Czyz [Thu, 31 Mar 2022 13:13:10 +0000 (08:13 -0500)]
Add an amount penalty to ProbabilisticScorer

The cost of large payments tends to be dominated by the channel fees. To
avoid this, add an amount penalty to ProbabilisticScorer with a user
configurable multiplier. The multiplier is applied for every 2^20th of
the amount weighted by the negative log10 of the channel's success
probability for the payment.

2 years agoAvoid retrying over recently failed channels
Jeffrey Czyz [Thu, 31 Mar 2022 02:20:58 +0000 (21:20 -0500)]
Avoid retrying over recently failed channels

In ProbabilisticScorer, the channel liquidity balance is reduced
whenever a payment fails at the corresponding channel. The payment may
still be retried through the channel, however, because the liquidity
penalty is capped. Use u64::max_value instead in this situation to avoid
retrying over the same path. This effectively makes u64::max_value the
penalty for amounts exceeding the upper bound, as well.

As an edge case, avoid using u64::max_value on attempts where the amount
is equal to the effective capacity, which may be the HTLC maximum when
the channel capacity is unknown.

2 years agoMerge pull request #1398 from jkczyz/2022-03-middle-hop-fix
Matt Corallo [Fri, 1 Apr 2022 19:32:08 +0000 (19:32 +0000)]
Merge pull request #1398 from jkczyz/2022-03-middle-hop-fix

Router fixes

2 years agoDon't consider a path as having hit HTLC-min if it isn't sufficient
Matt Corallo [Thu, 24 Mar 2022 18:38:43 +0000 (18:38 +0000)]
Don't consider a path as having hit HTLC-min if it isn't sufficient

During the first pass of path finding, we seek a single path with the
exact payment amount, and only seek additional paths if (a) no single
path can carry the entire balance of the payment or (b) we found a good
path, but along the way we found candidate paths with the potential to
result in a lower total fee. This commit fixes the behavior of (b) -- we
were previously considering some paths to be candidates for a lower fee
when in fact they never would have worked. This caused us to re-run
Dijkstra's when it might not have been beneficial.

2 years agoSelect best route by lowest total cost
Jeffrey Czyz [Wed, 30 Mar 2022 22:24:57 +0000 (17:24 -0500)]
Select best route by lowest total cost

Selecting only by fees rather than cost (fees plus penalty) may result
in preferring higher cost routes over lower cost ones.

2 years agoCorrectly pick middle hop to victimize
Jeffrey Czyz [Wed, 30 Mar 2022 18:43:45 +0000 (13:43 -0500)]
Correctly pick middle hop to victimize

For even-length paths, preferring a later hop avoids overly limiting the
possible paths on the next iteration.

2 years agoFix build warnings without grind_signatures
Jeffrey Czyz [Wed, 30 Mar 2022 19:43:39 +0000 (14:43 -0500)]
Fix build warnings without grind_signatures

2 years agoMerge pull request #1376 from jurvis/jurvis/persist-networkgraph
Jeffrey Czyz [Wed, 30 Mar 2022 20:38:39 +0000 (13:38 -0700)]
Merge pull request #1376 from jurvis/jurvis/persist-networkgraph

Persist NetworkGraph on removal of stale channels

2 years agoUse common Persister for persistence tests
Jurvis Tan [Tue, 29 Mar 2022 02:36:43 +0000 (19:36 -0700)]
Use common Persister for persistence tests

2 years agoMove expected_bytes to check_persisted_data! macro
Jurvis Tan [Tue, 29 Mar 2022 01:39:39 +0000 (18:39 -0700)]
Move expected_bytes to check_persisted_data! macro

2 years agoAdd NetworkGraph persistence
Jurvis Tan [Tue, 22 Mar 2022 03:13:14 +0000 (20:13 -0700)]
Add NetworkGraph persistence

Instead of creating a separate trait for persisting NetworkGraph, use and rename the existing ChannelManagerPersister to handle them both. persist_graph is then called on removal of stale channels and on exit.

2 years agoMerge pull request #1351 from TheBlueMatt/2022-03-scid-privacy
Matt Corallo [Mon, 28 Mar 2022 20:33:55 +0000 (20:33 +0000)]
Merge pull request #1351 from TheBlueMatt/2022-03-scid-privacy

Implement the SCIDAlias Channel Type and provide SCID Privacy

2 years agoMove inbound_payment module into its own file
Valentine Wallace [Thu, 24 Mar 2022 18:57:15 +0000 (14:57 -0400)]
Move inbound_payment module into its own file

As part of preparing to expose some of its methods as pub for ChannelManager-less
phantom invoice generation.

Pure code move of the module + the addition of module-level documentation

2 years agoAdd notes about SCID alias rotation to `ChannelDetails` docs 2022-03-scid-privacy
Matt Corallo [Mon, 28 Mar 2022 14:24:16 +0000 (14:24 +0000)]
Add notes about SCID alias rotation to `ChannelDetails` docs

2 years agoDrop the `Writeable::encode_with_len` method in non-test buidls
Matt Corallo [Tue, 15 Mar 2022 23:53:01 +0000 (23:53 +0000)]
Drop the `Writeable::encode_with_len` method in non-test buidls

There's not a lot of reason to keep it given its used in one place
outside of tests, and this lets us clean up some of the byte_utils
calls that are still lying around.

2 years agoUse the correct SCID when failing HTLCs to aliased channels
Matt Corallo [Tue, 8 Mar 2022 21:55:02 +0000 (21:55 +0000)]
Use the correct SCID when failing HTLCs to aliased channels

When we fail an HTLC which was destined for a channel that the HTLC
sender didn't know the real SCID for, we should ensure we continue
to use the alias in the channel_update we provide them. Otherwise
we will leak the channel's real SCID to HTLC senders.

2 years agoMake all callsites to `get_channel_update_for_unicast` fallible
Matt Corallo [Fri, 4 Mar 2022 20:20:19 +0000 (20:20 +0000)]
Make all callsites to `get_channel_update_for_unicast` fallible

This reduces unwraps in channelmanager by a good bit, providing
robustness for the upcoming 0conf changes which allow SCIDs to be
missing after a channel is in use, making
`get_channel_update_for_unicast` more fallible.

This also serves as a useful refactor for the next commit,
consolidating the channel_update creation sites which are changed
in the next commit.

2 years agoAdd simple tests for our SCIDAlias implementation and negotiation
Matt Corallo [Wed, 23 Feb 2022 18:10:42 +0000 (18:10 +0000)]
Add simple tests for our SCIDAlias implementation and negotiation

2 years agoNegotiate `scid_alias` for private channels based on a new config
Matt Corallo [Thu, 17 Feb 2022 22:13:54 +0000 (22:13 +0000)]
Negotiate `scid_alias` for private channels based on a new config

Because negotiating `scid_alias` for all of our channels will cause
us to create channels which LDK versions prior to 0.0.106 do not
understand, we disable `scid_alias` negotiation by default.

2 years agoAdd support for the SCIDAlias feature bit in incoming channels
Matt Corallo [Tue, 1 Feb 2022 17:23:52 +0000 (17:23 +0000)]
Add support for the SCIDAlias feature bit in incoming channels

This does not, however, ever send the scid_alias feature bit for
outgoing channels, as that would cause the immediately prior
version of LDK to be unable to read channel data.

2 years agoExpose chan type in `Event::OpenChannelRequest` & `ChannelDetails`
Matt Corallo [Wed, 16 Feb 2022 04:21:29 +0000 (04:21 +0000)]
Expose chan type in `Event::OpenChannelRequest` & `ChannelDetails`

As we add new supported channel types, inbound channels which use
new features may cause backwards-compatibility issues for clients.
If a new channel is opened using new features while a client still
wishes to ensure support for downgrading to a previous version of
LDK, that new channel may cause the `ChannelManager` to fail
deserialization due to unsupported feature flags.

By exposing the channel type flags to the user in channel requests,
users wishing to support downgrading to previous versions of LDK
can reject channels which use channel features which previous
versions of LDK do not understand.

2 years agoBump `check_commits` CI job rustc to 1.57
Matt Corallo [Sun, 27 Mar 2022 17:11:22 +0000 (17:11 +0000)]
Bump `check_commits` CI job rustc to 1.57

1.51 (and other earlier versions of `rustc`) appear to refuse to
accept our documentation links due to a bogus failure to resolve
`ChannelTypeFeatures::supports_scid_privacy`.

2 years agoMerge pull request #1388 from lightning-signer/2022-03-grind
Arik Sosman [Fri, 25 Mar 2022 23:35:21 +0000 (16:35 -0700)]
Merge pull request #1388 from lightning-signer/2022-03-grind

2 years agoMerge pull request #1375 from jkczyz/2022-03-scorer-followup
valentinewallace [Fri, 25 Mar 2022 21:01:46 +0000 (17:01 -0400)]
Merge pull request #1375 from jkczyz/2022-03-scorer-followup

ProbabilisticScorer optimizations

2 years agoMerge pull request #1382 from TheBlueMatt/2022-03-gossip-queries-sucks
Matt Corallo [Fri, 25 Mar 2022 19:49:37 +0000 (19:49 +0000)]
Merge pull request #1382 from TheBlueMatt/2022-03-gossip-queries-sucks

Fix gossip using `gossip_timestamp_filter` instead of queries

2 years agoAdd low_r signature grinding
Devrandom [Fri, 25 Mar 2022 19:34:02 +0000 (20:34 +0100)]
Add low_r signature grinding

default on, can be turned off via a feature gate

2 years agoMerge pull request #1381 from shamardy/2022-03-set-inbound-user-chan-id
valentinewallace [Fri, 25 Mar 2022 18:28:57 +0000 (14:28 -0400)]
Merge pull request #1381 from shamardy/2022-03-set-inbound-user-chan-id

Add `user_channel_id` to `accept_inbound_channel` method

2 years agoFix gossip using `gossip_timestamp_filter` instead of queries 2022-03-gossip-queries-sucks
Matt Corallo [Thu, 24 Mar 2022 03:00:06 +0000 (03:00 +0000)]
Fix gossip using `gossip_timestamp_filter` instead of queries

See large comment added for more details

2 years agoIncrease default liquidity_penalty_multiplier_msat
Jeffrey Czyz [Fri, 25 Mar 2022 14:41:14 +0000 (09:41 -0500)]
Increase default liquidity_penalty_multiplier_msat

Using a larger multiplier gives more reasonable penalties for larger
success probabilities.

2 years agoMove max penalty cap in ProbabilisticScorer
Jeffrey Czyz [Fri, 25 Mar 2022 14:35:35 +0000 (09:35 -0500)]
Move max penalty cap in ProbabilisticScorer

This reduce a branch in the 0 and u6::max_value cases.

2 years agoFix overflow in ProbabilisticScorer
Jeffrey Czyz [Thu, 24 Mar 2022 23:21:29 +0000 (18:21 -0500)]
Fix overflow in ProbabilisticScorer

When a routing hint is given in an invoice, the effective capacity of
the channel is assumed to be infinite (i.e., u64::max_value) if the hop
is private. Adding 1 to this in the success probability calculation will
cause an overflow and ultimately an `index out of bounds panic` in
log10_times_1024. This was not an issue with using log10 because the use
of f64 would give infinite which casts to 0 for u64.

2 years agoAdd a base penalty to ProbabilisticScorer
Jeffrey Czyz [Tue, 22 Mar 2022 00:11:48 +0000 (19:11 -0500)]
Add a base penalty to ProbabilisticScorer

ProbabilisticScorer tends to prefer longer routes to shorter ones. Make
the default scoring behavior include a customizable base penalty to
avoid longer routes.

2 years agoDon't serialize FixedPenaltyScorer parameters
Jeffrey Czyz [Mon, 21 Mar 2022 20:29:21 +0000 (15:29 -0500)]
Don't serialize FixedPenaltyScorer parameters

Serializing scorer parameters makes it difficult to experiment with
different settings.

2 years agoset user_channel_id in accept_inbound_channel fn
Omar Shamardy [Thu, 24 Mar 2022 00:00:31 +0000 (02:00 +0200)]
set user_channel_id in accept_inbound_channel fn

fix docs

edit user_channel_id docs for Event::ChannelClosed

review fixes

2 years agoMerge pull request #1359 from tnull/2022-03-real-random-shuffle
Matt Corallo [Thu, 24 Mar 2022 23:13:12 +0000 (23:13 +0000)]
Merge pull request #1359 from tnull/2022-03-real-random-shuffle

Randomize candidate paths during route selection.

2 years agoMerge pull request #1380 from TheBlueMatt/2022-03-skip-redundant-sig-checks
Matt Corallo [Thu, 24 Mar 2022 22:51:17 +0000 (22:51 +0000)]
Merge pull request #1380 from TheBlueMatt/2022-03-skip-redundant-sig-checks

Skip `channel_update` signature checks if we have a newer state

2 years agoSkip `channel_update` signature checks if we have a newer state 2022-03-skip-redundant-sig-checks
Matt Corallo [Wed, 23 Mar 2022 22:10:15 +0000 (22:10 +0000)]
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.

2 years agoMerge pull request #1058 from TheBlueMatt/2021-08-fail-claimed-dust-htlc
valentinewallace [Thu, 24 Mar 2022 17:01:56 +0000 (13:01 -0400)]
Merge pull request #1058 from TheBlueMatt/2021-08-fail-claimed-dust-htlc

Add a further test of HTLC failure after a claim occurrs.

2 years agoMinor refactor for sort / add, and some nits.
Elias Rohrer [Thu, 24 Mar 2022 15:12:44 +0000 (09:12 -0600)]
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

2 years agoRandomize candidate paths during route selection.
Elias Rohrer [Thu, 24 Mar 2022 15:12:26 +0000 (09:12 -0600)]
Randomize candidate paths during route selection.

2 years agoAdd a further test of HTLC failure after a claim occurrs. 2021-08-fail-claimed-dust-htlc
Matt Corallo [Tue, 24 Aug 2021 03:46:47 +0000 (03:46 +0000)]
Add a further test of HTLC failure after a claim occurrs.

This adds a further test of 7e78fa660cec8a73286c94c1073ee588140e7a01
which I had lying around in my TODO list for a while.

2 years agoMerge pull request #1370 from TheBlueMatt/2022-03-pref-first-hop-chans
Matt Corallo [Wed, 23 Mar 2022 22:44:37 +0000 (22:44 +0000)]
Merge pull request #1370 from TheBlueMatt/2022-03-pref-first-hop-chans

Avoid needless MPP on multiple channels to the same first-hop

2 years agoMerge pull request #1360 from tnull/2022-03-loopless-random-walks
Matt Corallo [Wed, 23 Mar 2022 21:40:25 +0000 (21:40 +0000)]
Merge pull request #1360 from tnull/2022-03-loopless-random-walks

Avoid looping CLTV shadow routes.

2 years agoMerge pull request #1326 from Psycho-Pirate/peers
Matt Corallo [Wed, 23 Mar 2022 21:02:17 +0000 (21:02 +0000)]
Merge pull request #1326 from Psycho-Pirate/peers

Added option to send remote IP to peers

2 years agoAvoid needless MPP on multiple channels to the same first-hop 2022-03-pref-first-hop-chans
Matt Corallo [Fri, 18 Mar 2022 23:19:51 +0000 (23:19 +0000)]
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.

2 years agoAvoid looping CLTV shadow routes.
Elias Rohrer [Wed, 23 Mar 2022 15:30:59 +0000 (09:30 -0600)]
Avoid looping CLTV shadow routes.

2 years agoMerge pull request #1374 from TheBlueMatt/2022-03-bindings-cleanups
Matt Corallo [Wed, 23 Mar 2022 00:46:31 +0000 (00:46 +0000)]
Merge pull request #1374 from TheBlueMatt/2022-03-bindings-cleanups

Trivial Bindings Cleanups

2 years agoArgument added in lightning-net-tokio/src/lib.rs and comments updated
psycho-pirate [Tue, 15 Mar 2022 22:33:09 +0000 (04:03 +0530)]
Argument added in lightning-net-tokio/src/lib.rs and comments updated

2 years agoadded network address in methods, filter_address function with tests and updated...
psycho-pirate [Sat, 12 Mar 2022 19:10:35 +0000 (00:40 +0530)]
added network address in methods, filter_address function with tests and updated documentation

2 years agoMerge pull request #1353 from dunxen/2022-03-mpp-receive-timeout
valentinewallace [Tue, 22 Mar 2022 21:15:18 +0000 (17:15 -0400)]
Merge pull request #1353 from dunxen/2022-03-mpp-receive-timeout

Add MPP receive timeout handling

2 years agoMerge pull request #1373 from lightningdevkit/dependabot/github_actions/actions/cache-3
valentinewallace [Tue, 22 Mar 2022 20:39:57 +0000 (16:39 -0400)]
Merge pull request #1373 from lightningdevkit/dependabot/github_actions/actions/cache-3

Bump actions/cache from 2 to 3

2 years agoMerge pull request #1368 from TheBlueMatt/2022-03-fix-post-start-sync
Matt Corallo [Tue, 22 Mar 2022 19:23:51 +0000 (19:23 +0000)]
Merge pull request #1368 from TheBlueMatt/2022-03-fix-post-start-sync

Send a gossip_timestamp_filter on connect to enable gossip sync

2 years agoAdd MPP receive timeout handling
Duncan Dean [Thu, 3 Mar 2022 19:06:40 +0000 (21:06 +0200)]
Add MPP receive timeout handling

2 years agoMerge pull request #1352 from TheBlueMatt/2022-03-debug-rwlock
Matt Corallo [Tue, 22 Mar 2022 04:19:12 +0000 (04:19 +0000)]
Merge pull request #1352 from TheBlueMatt/2022-03-debug-rwlock

Implement lockorder checking on RwLocks in debug_sync

2 years agoUse `impl<bounds>` instead of a `where` clause to help bindings 2022-03-bindings-cleanups
Matt Corallo [Mon, 21 Mar 2022 20:08:37 +0000 (20:08 +0000)]
Use `impl<bounds>` instead of a `where` clause to help bindings

2 years agoTag some type aliases with `(C-not exported)`
Matt Corallo [Fri, 18 Mar 2022 03:28:25 +0000 (03:28 +0000)]
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.

2 years agoBump actions/cache from 2 to 3
dependabot[bot] [Mon, 21 Mar 2022 17:38:00 +0000 (17:38 +0000)]
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>
2 years agoMerge pull request #1361 from luizParreira/rust-lightning/issues/1280
Matt Corallo [Fri, 18 Mar 2022 20:29:23 +0000 (20:29 +0000)]
Merge pull request #1361 from luizParreira/rust-lightning/issues/1280

Create normal/phantom invoice with description hash

2 years agoUse the term "lock" for `Mutex`/`RwLock` instead of "mutex" 2022-03-debug-rwlock
Matt Corallo [Wed, 9 Mar 2022 19:10:59 +0000 (19:10 +0000)]
Use the term "lock" for `Mutex`/`RwLock` instead of "mutex"

2 years agoImplement lockorder checking on RwLocks in debug_sync
Matt Corallo [Wed, 9 Mar 2022 06:24:06 +0000 (06:24 +0000)]
Implement lockorder checking on RwLocks in debug_sync

2 years agoCreate normal/phantom invoice with description hash
Luiz Parreira [Sun, 13 Mar 2022 15:15:00 +0000 (12:15 -0300)]
Create normal/phantom invoice with description hash

2 years agoMerge pull request #1363 from TheBlueMatt/2022-03-tx-conf-ordering-lock-delay
Matt Corallo [Fri, 18 Mar 2022 17:20:53 +0000 (17:20 +0000)]
Merge pull request #1363 from TheBlueMatt/2022-03-tx-conf-ordering-lock-delay

Generate a funding_locked on relevant transactions_confirmed calls

2 years agoSend a `gossip_timestamp_filter` on connect to enable gossip sync 2022-03-fix-post-start-sync
Matt Corallo [Thu, 17 Mar 2022 22:14:43 +0000 (22:14 +0000)]
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.

2 years agoRename `RoutingMessageHandler::sync_routing_table` `peer_connected`
Matt Corallo [Thu, 17 Mar 2022 22:04:48 +0000 (22:04 +0000)]
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.

2 years agoMerge pull request #1358 from TheBlueMatt/2022-03-max-cltv
Matt Corallo [Thu, 17 Mar 2022 05:13:56 +0000 (05:13 +0000)]
Merge pull request #1358 from TheBlueMatt/2022-03-max-cltv

Make `max_total_cltv_expiry_delta` include the final CLTV

2 years agoMake `max_total_cltv_expiry_delta` include the final CLTV 2022-03-max-cltv
Matt Corallo [Wed, 9 Mar 2022 23:04:15 +0000 (23:04 +0000)]
Make `max_total_cltv_expiry_delta` include the final CLTV

This fixes an integer underflow found by the `router` fuzz target
in CI.

2 years agoMake routing benchmark robust against path changes
Matt Corallo [Thu, 10 Mar 2022 21:07:37 +0000 (21:07 +0000)]
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.

2 years agoMerge pull request #1325 from ViktorTigerstrom/2022-02-filter-route-hints
Matt Corallo [Wed, 16 Mar 2022 17:32:40 +0000 (17:32 +0000)]
Merge pull request #1325 from ViktorTigerstrom/2022-02-filter-route-hints

Filter route hints when creating invoices

2 years agoAdd phantom invoice route hints filtering tests
Viktor Tigerström [Mon, 21 Feb 2022 20:22:26 +0000 (21:22 +0100)]
Add phantom invoice route hints filtering tests

2 years agoFilter route hints for phantom invoices
Viktor Tigerström [Mon, 21 Feb 2022 20:18:45 +0000 (21:18 +0100)]
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.

2 years agoAdd tests for create invoice route hints filtering
Viktor Tigerström [Mon, 21 Feb 2022 01:31:21 +0000 (02:31 +0100)]
Add tests for create invoice route hints filtering

2 years agoFilter route hints for create invoice
Viktor Tigerström [Mon, 21 Feb 2022 01:31:21 +0000 (02:31 +0100)]
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

2 years agoGenerate a funding_locked on relevant transactions_confirmed calls 2022-03-tx-conf-ordering-lock-delay
Matt Corallo [Sun, 13 Mar 2022 21:35:46 +0000 (21:35 +0000)]
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.

2 years agoMerge pull request #1331 from TheBlueMatt/2022-02-no-copy-invoice-fields
Jeffrey Czyz [Fri, 11 Mar 2022 20:26:02 +0000 (14:26 -0600)]
Merge pull request #1331 from TheBlueMatt/2022-02-no-copy-invoice-fields

Use &mut self in invoice updaters, not take-self-return-Self

2 years agoMerge pull request #1311 from TheBlueMatt/2022-02-0conf-part-1
Matt Corallo [Thu, 10 Mar 2022 00:47:23 +0000 (00:47 +0000)]
Merge pull request #1311 from TheBlueMatt/2022-02-0conf-part-1

Support for SCID Aliases

2 years agoMerge pull request #1341 from jkczyz/2022-03-expiry-time-panic
valentinewallace [Wed, 9 Mar 2022 23:19:22 +0000 (18:19 -0500)]
Merge pull request #1341 from jkczyz/2022-03-expiry-time-panic

Correct docs about invoice_expiry_delta_secs panic

2 years agoMerge pull request #1349 from TheBlueMatt/2022-03-listen-send-sync
Jeffrey Czyz [Wed, 9 Mar 2022 22:41:40 +0000 (16:41 -0600)]
Merge pull request #1349 from TheBlueMatt/2022-03-listen-send-sync

Require `chain::Listen` impls in block sync be `Send + Sync`

2 years agoMerge pull request #1348 from TheBlueMatt/2022-03-timer-tick-count
Matt Corallo [Wed, 9 Mar 2022 21:28:05 +0000 (21:28 +0000)]
Merge pull request #1348 from TheBlueMatt/2022-03-timer-tick-count

Reduce the number of timer ticks a peer is allowed to take

2 years agoMerge pull request #1355 from lightningdevkit/dependabot/cargo/lightning/regex-0...
Matt Corallo [Wed, 9 Mar 2022 21:27:50 +0000 (21:27 +0000)]
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

2 years agoCorrect docs about invoice_expiry_delta_secs panic
Jeffrey Czyz [Wed, 2 Mar 2022 00:44:30 +0000 (16:44 -0800)]
Correct docs about invoice_expiry_delta_secs panic

2 years agoSupport receiving multiple funding_locked messages 2022-02-0conf-part-1
Matt Corallo [Tue, 1 Feb 2022 17:37:28 +0000 (17:37 +0000)]
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.

2 years agoProvide our peers with SCID aliases and forward payments with them
Matt Corallo [Tue, 15 Feb 2022 23:27:07 +0000 (23:27 +0000)]
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.

2 years agoHandle `short_to_id` state updates on channel closure via macros
Matt Corallo [Tue, 8 Feb 2022 21:43:14 +0000 (21:43 +0000)]
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.