rust-lightning
2 months agoDrop `lightning-invoice` dependency on hashbrown` 2024-02-no-ahash
Matt Corallo [Tue, 13 Feb 2024 18:15:20 +0000 (18:15 +0000)]
Drop `lightning-invoice` dependency on hashbrown`

2 months agoDrop `ahash` dependency in favor of core's `SipHasher`
Matt Corallo [Mon, 12 Feb 2024 22:40:49 +0000 (22:40 +0000)]
Drop `ahash` dependency in favor of core's `SipHasher`

https://github.com/tkaitchuck/aHash/pull/196 bumped the MSRV of
`ahash` in a patch release, which makes it rather difficult for us
to have it as a dependency.

Further, it seems that `ahash` hasn't been particularly robust in
the past, notably
https://github.com/tkaitchuck/aHash/issues/163 and
https://github.com/tkaitchuck/aHash/issues/166.

Luckily, `core` provides `SipHasher` even on no-std (sadly its
SipHash-2-4 unlike the SipHash-1-3 used by the `DefaultHasher` in
`std`). Thus, we drop the `ahash` dependency entirely here and
simply wrap `SipHasher` for our `no-std` HashMaps.

2 months agoAdd a crate which wraps `getrandom` but always compiles
Matt Corallo [Mon, 12 Feb 2024 22:37:09 +0000 (22:37 +0000)]
Add a crate which wraps `getrandom` but always compiles

In the next commit we'll drop the `ahash` dependency in favor of
directly calling `getrandom` to seed our hash tables. However,
we'd like to depend on `getrandom` only on certain platforms *and*
only when certain features (no-std) are set.

This introduces an indirection crate to do so, allowing us to
depend on it only when `no-std` is set but only depending on
`getrandom` on platforms which it supports.

2 months agoMerge pull request #2861 from tnull/2024-01-introduce-cargo-audit
Matt Corallo [Tue, 13 Feb 2024 21:35:51 +0000 (21:35 +0000)]
Merge pull request #2861 from tnull/2024-01-introduce-cargo-audit

Introduce CI workflow running `cargo audit`

2 months agoMerge pull request #2816 from wpaulino/retryable-holder-sigs
Matt Corallo [Tue, 13 Feb 2024 21:22:55 +0000 (21:22 +0000)]
Merge pull request #2816 from wpaulino/retryable-holder-sigs

Allow holder commitment and HTLC signature requests to fail

2 months agoMerge pull request #2892 from TheBlueMatt/2024-02-destination-eq
Elias Rohrer [Tue, 13 Feb 2024 08:21:04 +0000 (09:21 +0100)]
Merge pull request #2892 from TheBlueMatt/2024-02-destination-eq

Add further standard derives to various onion message structs

2 months agoIntroduce CI workflow running `cargo audit`
Elias Rohrer [Tue, 30 Jan 2024 11:41:05 +0000 (12:41 +0100)]
Introduce CI workflow running `cargo audit`

In order to continuously monitor our dependencies for security
vulnerabilities, we introduce a new CI job that will use `cargo audit`
to check for any known vulnerabilities.

This job is run on a daily schedule. For each new advisory, a new issue
will be created.

2 months agoAdd further standard derives to various onion message structs 2024-02-destination-eq
Matt Corallo [Mon, 12 Feb 2024 23:54:14 +0000 (23:54 +0000)]
Add further standard derives to various onion message structs

2 months agoMerge pull request #2888 from TheBlueMatt/2024-02-destination-eq
Elias Rohrer [Mon, 12 Feb 2024 12:29:15 +0000 (13:29 +0100)]
Merge pull request #2888 from TheBlueMatt/2024-02-destination-eq

Implement `Debug`/`PartialEq`/`Eq` for `Destination`

2 months agoDrop `reqwest` pin
Elias Rohrer [Thu, 1 Feb 2024 08:41:01 +0000 (09:41 +0100)]
Drop `reqwest` pin

.. since a version with fixed MSRV was released by now.

2 months agoMove `lightning-transaction-sync` to main workspace
Elias Rohrer [Thu, 1 Feb 2024 08:31:06 +0000 (09:31 +0100)]
Move `lightning-transaction-sync` to main workspace

.. so it's actually included in the audit.

2 months agoDisable `lightning-transaction-sync` integration tests on Windows
Elias Rohrer [Thu, 1 Feb 2024 08:57:05 +0000 (09:57 +0100)]
Disable `lightning-transaction-sync` integration tests on Windows

.. as the `electrsd` crate doesn't support it.

While we previously did so in our CI script, we now also `cfg`-gate the
tests and dependencies for easier handling.

2 months agoImplement `Debug`/`PartialEq`/`Eq` for `Destination`
Matt Corallo [Sat, 10 Feb 2024 02:27:59 +0000 (02:27 +0000)]
Implement `Debug`/`PartialEq`/`Eq` for `Destination`

2 months agoMerge pull request #2850 from TheBlueMatt/2024-01-fuzz-gossip
Matt Corallo [Fri, 9 Feb 2024 00:49:33 +0000 (00:49 +0000)]
Merge pull request #2850 from TheBlueMatt/2024-01-fuzz-gossip

2 months agoMerge pull request #2886 from TheBlueMatt/2024-02-actually-fix-build
Matt Corallo [Fri, 9 Feb 2024 00:08:28 +0000 (00:08 +0000)]
Merge pull request #2886 from TheBlueMatt/2024-02-actually-fix-build

 Fix silent merge conflict introduced in d3ddf15 @TheBlueMatt

2 months agoReplace spaces with tabs in msgs.rs 2024-02-actually-fix-build
Matt Corallo [Thu, 8 Feb 2024 23:03:44 +0000 (23:03 +0000)]
Replace spaces with tabs in msgs.rs

2 months agoFix silent merge conflict introduced in d3ddf15357589ed10f4c844dc22
Matt Corallo [Thu, 8 Feb 2024 23:04:19 +0000 (23:04 +0000)]
Fix silent merge conflict introduced in d3ddf15357589ed10f4c844dc22

2 months agoMerge pull request #2885 from benthecarman/tiny-opt
Matt Corallo [Thu, 8 Feb 2024 22:55:53 +0000 (22:55 +0000)]
Merge pull request #2885 from benthecarman/tiny-opt

Worlds smallest optimization

2 months agoWorlds smallest optimization
benthecarman [Thu, 8 Feb 2024 17:57:13 +0000 (17:57 +0000)]
Worlds smallest optimization

Preallocate for 8 items in the vec. I chose this value for

1. features
2. description
3. payment hash
4. expire time
5. min_final_cltv
6. payment secret
7. route hint
8. for the memes

2 months agoMerge pull request #2871 from dunxen/2024-02-msgcommonfields
Matt Corallo [Thu, 8 Feb 2024 21:50:27 +0000 (21:50 +0000)]
Merge pull request #2871 from dunxen/2024-02-msgcommonfields

Combine common fields for OpenChannel and AcceptChannel V1 & V2

2 months agoAllow holder commitment and HTLC signature requests to fail
Wilmer Paulino [Tue, 30 Jan 2024 22:45:46 +0000 (14:45 -0800)]
Allow holder commitment and HTLC signature requests to fail

As part of the ongoing async signer work, our holder signatures must
also be capable of being obtained asynchronously. We expose a new
`ChannelMonitor::signer_unblocked` method to retry pending onchain
claims by re-signing and rebroadcasting transactions. Unfortunately, we
cannot retry said claims without them being registered first, so if
we're not able to obtain the signature synchronously, we must return the
transaction as unsigned and ensure it is not broadcast.

2 months agoIntroduce FeerateStrategy enum for onchain claims
Wilmer Paulino [Tue, 30 Jan 2024 22:45:44 +0000 (14:45 -0800)]
Introduce FeerateStrategy enum for onchain claims

This refactors the existing `force_feerate_bump` flag into an enum as we
plan to introduce a new flag/enum variant in a future commit.

2 months agoRework get_latest_holder_commitment_txn to broadcast for users
Wilmer Paulino [Tue, 30 Jan 2024 22:45:44 +0000 (14:45 -0800)]
Rework get_latest_holder_commitment_txn to broadcast for users

This method is meant to be used as a last resort when a user is forced
to broadcast the current state, even if it is stale, in an attempt to
claim their funds in the channel. Previously, we'd return the commitment
and HTLC transactions such that they broadcast them themselves. Doing so
required a different code path, one which was not tested, to obtain
these transactions than our usual path when force closing. It's not
worth maintaining both, and it's much simpler for us to broadcast
instead.

2 months agoMerge pull request #2856 from valentinewallace/2024-01-blinded-payinfo-min-final...
Matt Corallo [Wed, 7 Feb 2024 22:12:59 +0000 (22:12 +0000)]
Merge pull request #2856 from valentinewallace/2024-01-blinded-payinfo-min-final-cltv

Route blinding: add `min_final_cltv_delta` to aggregated CLTV delta

2 months agoAdd min_final_cltv_delta to aggregated CLTV delta.
Valentine Wallace [Fri, 26 Jan 2024 20:17:27 +0000 (15:17 -0500)]
Add min_final_cltv_delta to aggregated CLTV delta.

The spec was previously missing this requirement.

2 months agoParameterize BlindedPath::new_for_payment by min final CLTV delta.
Valentine Wallace [Fri, 26 Jan 2024 19:34:40 +0000 (14:34 -0500)]
Parameterize BlindedPath::new_for_payment by min final CLTV delta.

Currently we are not including this value in the aggregated CLTV delta, which
is wrong.

2 months ago[fuzz] Add fst coverage for `ChannelManager::update_channel_config` 2024-01-fuzz-gossip
Matt Corallo [Wed, 7 Feb 2024 02:27:22 +0000 (02:27 +0000)]
[fuzz] Add fst coverage for `ChannelManager::update_channel_config`

2 months ago[fuzz] Add a second full_stack_target seed test for gossip
Matt Corallo [Sat, 20 Jan 2024 08:27:23 +0000 (08:27 +0000)]
[fuzz] Add a second full_stack_target seed test for gossip

2 months ago[fuzz] De-dup hex in test_no_existing_test_breakage
Matt Corallo [Sat, 20 Jan 2024 08:26:07 +0000 (08:26 +0000)]
[fuzz] De-dup hex in test_no_existing_test_breakage

This will make test_no_existing_test_breakage marginally easier to
update.

2 months ago[fuzz] Add additional method calls in full_stack_target
Matt Corallo [Fri, 19 Jan 2024 00:42:17 +0000 (00:42 +0000)]
[fuzz] Add additional method calls in full_stack_target

The whole point of full_stack_target is to just expose our entire
API to the fuzzer and see what happens. Sadly, we're really only
exposing a small subset of our API. This improves that by exposing
a handful of other assorted methods from ChannelManager and
PeerManager.

2 months ago[fuzz] Use batch funding in full_stack_target
Matt Corallo [Fri, 19 Jan 2024 00:41:57 +0000 (00:41 +0000)]
[fuzz] Use batch funding in full_stack_target

To potentially get more test coverage

2 months agoMerge pull request #2873 from tnull/2024-02-expose-channel-details-in-bte
Matt Corallo [Wed, 7 Feb 2024 00:57:01 +0000 (00:57 +0000)]
Merge pull request #2873 from tnull/2024-02-expose-channel-details-in-bte

Expose `channel_id` / `counterparty_node_id` in `BumpTransaction` event

2 months agoMerge pull request #2878 from TheBlueMatt/2024-02-fix-build
Matt Corallo [Wed, 7 Feb 2024 00:28:50 +0000 (00:28 +0000)]
Merge pull request #2878 from TheBlueMatt/2024-02-fix-build

Small comment tweaks

2 months agoExpose `channel_id` / `counterparty_node_id` in `BumpTransaction` event
Elias Rohrer [Mon, 5 Feb 2024 13:47:39 +0000 (14:47 +0100)]
Expose `channel_id` / `counterparty_node_id` in `BumpTransaction` event

A client node might choose not to handle `Event::BumptTransaction`
events and leave bumping / Anchor output spending to a trusted
counterparty.

However, `Event::BumptTransaction` currently doesn't offer any clear
indication what channel and/or counterparty it is referring to. In order
to allow filtering these events, we here expose the `channel_id` and
`counterparty_node_id` fields.

2 months agoNote when new HTLC state can be `None` 2024-02-fix-build
Matt Corallo [Tue, 6 Feb 2024 18:53:56 +0000 (18:53 +0000)]
Note when new HTLC state can be `None`

2 months agoFix comment spelling
Matt Corallo [Mon, 5 Feb 2024 23:54:56 +0000 (23:54 +0000)]
Fix comment spelling

2 months agoMerge pull request #2442 from wvanlint/list_pending_htlcs
Matt Corallo [Tue, 6 Feb 2024 18:45:36 +0000 (18:45 +0000)]
Merge pull request #2442 from wvanlint/list_pending_htlcs

Include pending HTLC's in ChannelDetails

2 months agoMerge pull request #2876 from TheBlueMatt/2024-02-2863-doc-nits
Elias Rohrer [Tue, 6 Feb 2024 10:44:32 +0000 (11:44 +0100)]
Merge pull request #2876 from TheBlueMatt/2024-02-2863-doc-nits

Minor doc nits on the new coop close reason variants

2 months agoInclude pending HTLCs in ChannelDetails
Willem Van Lint [Sat, 5 Aug 2023 00:07:04 +0000 (17:07 -0700)]
Include pending HTLCs in ChannelDetails

This exposes details around pending HTLCs in ChannelDetails.  The state
of the HTLC in the state machine is also included, so it can be
determined which protocol message the HTLC is waiting for to advance.

2 months ago[fuzz] Fix misc warnings in full_stack_target
Matt Corallo [Fri, 19 Jan 2024 01:12:14 +0000 (01:12 +0000)]
[fuzz] Fix misc warnings in full_stack_target

2 months ago[fuzz] Reduce size of `payments_sent` in full_stack_target
Matt Corallo [Fri, 19 Jan 2024 00:41:25 +0000 (00:41 +0000)]
[fuzz] Reduce size of `payments_sent` in full_stack_target

Slightly reducing the amount of data we read to do things.

2 months agoMerge pull request #2810 from TheBlueMatt/2023-12-arbitrary-fuzz-config
Matt Corallo [Mon, 5 Feb 2024 23:53:06 +0000 (23:53 +0000)]
Merge pull request #2810 from TheBlueMatt/2023-12-arbitrary-fuzz-config

Update `full_stack_target` to take an arbitrary config object

2 months agoMerge pull request #2847 from TheBlueMatt/2024-01-bindings-upstream
Matt Corallo [Mon, 5 Feb 2024 23:49:19 +0000 (23:49 +0000)]
Merge pull request #2847 from TheBlueMatt/2024-01-bindings-upstream

Misc Tweaks for bindings

2 months agoMinor doc nits on the new coop close reason variants 2024-02-2863-doc-nits
Matt Corallo [Mon, 5 Feb 2024 23:47:36 +0000 (23:47 +0000)]
Minor doc nits on the new coop close reason variants

2 months agoMerge pull request #2725 from shaavan/issue2096
Matt Corallo [Mon, 5 Feb 2024 23:44:36 +0000 (23:44 +0000)]
Merge pull request #2725 from shaavan/issue2096

Ensure successful message propagation in case of disconnection mid-handshake

2 months agoMerge pull request #2863 from benthecarman/breakup-coop-close
Matt Corallo [Mon, 5 Feb 2024 23:43:26 +0000 (23:43 +0000)]
Merge pull request #2863 from benthecarman/breakup-coop-close

Breakup CooperativeClosure into Local/Remote initiated

2 months agoMerge pull request #2872 from tnull/2024-02-add-features-to-channel-pending
Matt Corallo [Mon, 5 Feb 2024 19:58:51 +0000 (19:58 +0000)]
Merge pull request #2872 from tnull/2024-02-add-features-to-channel-pending

Expose `channel_type` in `Event::ChannelPending`

2 months agoExpose `channel_type` in `Event::ChannelPending`
Elias Rohrer [Mon, 5 Feb 2024 13:32:33 +0000 (14:32 +0100)]
Expose `channel_type` in `Event::ChannelPending`

It is useful to immediately know what kind of channel is being opened,
and not having to wait until `ChannelReady`.

2 months agoRename old CooperativeClosure to LegacyCooperativeClosure
benthecarman [Sun, 4 Feb 2024 16:33:08 +0000 (16:33 +0000)]
Rename old CooperativeClosure to LegacyCooperativeClosure

2 months agoBreakup CooperativeClosure into Local/Remote initiated
benthecarman [Wed, 31 Jan 2024 00:32:37 +0000 (00:32 +0000)]
Breakup CooperativeClosure into Local/Remote initiated

3 months ago[fuzz] Fix slice copy in `peer_crypt_target` 2023-12-arbitrary-fuzz-config
Matt Corallo [Wed, 31 Jan 2024 19:48:44 +0000 (19:48 +0000)]
[fuzz] Fix slice copy in `peer_crypt_target`

This has apparently been broken for quite some time...I guess
`peer_crypt_target` doesn't get much CPU anymore.

3 months agoFix test variable typos
Matt Corallo [Thu, 11 Jan 2024 21:33:53 +0000 (21:33 +0000)]
Fix test variable typos

3 months agoBump `hashbrown` dependency to 0.13
Matt Corallo [Thu, 18 Jan 2024 22:39:26 +0000 (22:39 +0000)]
Bump `hashbrown` dependency to 0.13

While this isn't expected to materially improve performance, it
does get us ahash 0.8, which allows us to reduce fuzzing
randomness, making our fuzzers much happier.

Sadly, by default `ahash` no longer tries to autodetect a
randomness source, so we cannot simply rely on `hashbrown` to do
randomization for us, but rather have to also explicitly depend on
`ahash`.

3 months agoStop relying on `Hash{Set,Map}::from_iter` directly
Matt Corallo [Thu, 18 Jan 2024 20:27:57 +0000 (20:27 +0000)]
Stop relying on `Hash{Set,Map}::from_iter` directly

In the next commit we'll bump the `hashbrown` version, which no
longer randomizes its hasher by default. Thus, we'll need to call
a different constructor in no-std builds from std builds.

Here we do a quick prefactor to use wrappers for `FromIterator`
constructors instead of calling the tables directly to make the
version bump changeset smaller.

3 months agoUse utility methods to construct `HashMap`s and `HashSet`s
Matt Corallo [Mon, 1 Jan 2024 21:53:36 +0000 (21:53 +0000)]
Use utility methods to construct `HashMap`s and `HashSet`s

In the next commit we'll bump the `hashbrown` version, which no
longer randomizes its hasher by default. Thus, we'll need to call
a different constructor in no-std builds from std builds.

Here we do a quick prefactor to use wrappers for constructors
instead of calling the tables directly to make the version bump
changeset smaller.

3 months agoUpdate fuzz CI job to use our MSRV rather than 1.58
Matt Corallo [Thu, 18 Jan 2024 20:34:56 +0000 (20:34 +0000)]
Update fuzz CI job to use our MSRV rather than 1.58

3 months agoUse arbitrary config object in full_stack_target fuzzer
Matt Corallo [Sat, 23 Dec 2023 19:13:34 +0000 (19:13 +0000)]
Use arbitrary config object in full_stack_target fuzzer

As we've added more and more configuration parameters which change
our behavior, we're increasingly missing coverage in the general
`full_stack_target` fuzzer. Sadly, a reachable `unwrap` slipped in
uncaught that should have been stopped by the `full_stack_target`.

Here, we update the `full_stack_target` fuzzer to read a full
config object to substantially increase coverage.

3 months agoDisable fuzzing-reachable debug assertions in `ChannelMonitor`s
Matt Corallo [Mon, 25 Dec 2023 00:54:45 +0000 (00:54 +0000)]
Disable fuzzing-reachable debug assertions in `ChannelMonitor`s

3 months agoDisable fuzzing-reachable debug assertion
Matt Corallo [Sun, 24 Dec 2023 17:12:18 +0000 (17:12 +0000)]
Disable fuzzing-reachable debug assertion

Because of txid conflicts, a txid can match both a local and remote
commitment transaction when fuzzing. Thus, we disable this
assertion when fuzzing.

3 months agoMerge pull request #2868 from orbitalturtle/export-send-onion-path
Jeffrey Czyz [Fri, 2 Feb 2024 17:18:24 +0000 (11:18 -0600)]
Merge pull request #2868 from orbitalturtle/export-send-onion-path

export send_onion_message_using_path for testing

3 months agoMerge pull request #2870 from benthecarman/pub-source-target
Matt Corallo [Fri, 2 Feb 2024 17:08:52 +0000 (17:08 +0000)]
Merge pull request #2870 from benthecarman/pub-source-target

Make DirectedChannelInfo `source` and `target` public

3 months agoCombine common fields of `AcceptChannel` & `AcceptChannelV2` into struct
Duncan Dean [Fri, 2 Feb 2024 14:54:23 +0000 (16:54 +0200)]
Combine common fields of `AcceptChannel` & `AcceptChannelV2` into struct

3 months agoMake DirectedChannelInfo `source` and `target` public
benthecarman [Fri, 2 Feb 2024 14:14:51 +0000 (14:14 +0000)]
Make DirectedChannelInfo `source` and `target` public

We use these params for our HubPreferentialScorer and without these
utility functions then we have to manually do this and calculate which
is the source and which is the target node.

3 months agoCombine common fields of `OpenChannel` & `OpenChannelV2` into struct
Duncan Dean [Fri, 2 Feb 2024 12:39:42 +0000 (14:39 +0200)]
Combine common fields of `OpenChannel` & `OpenChannelV2` into struct

3 months agoexport send_onion_message_using_path for testing
Orbital [Fri, 2 Feb 2024 02:22:53 +0000 (20:22 -0600)]
export send_onion_message_using_path for testing

3 months agoMerge pull request #2858 from tnull/2024-01-expose-skimmed-fee-msat
valentinewallace [Thu, 1 Feb 2024 14:42:22 +0000 (09:42 -0500)]
Merge pull request #2858 from tnull/2024-01-expose-skimmed-fee-msat

Expose withheld amount for underpaying HTLCs in `PaymentForwarded`

3 months agoExpose `skimmed_fee_msat` in `PaymentForwarded`
Elias Rohrer [Mon, 29 Jan 2024 15:16:08 +0000 (16:16 +0100)]
Expose `skimmed_fee_msat` in `PaymentForwarded`

We generally allow routing nodes to forward less than the expected HTLC
amount, if the receiver knowingly accepts this and claims the
underpaying HTLC (see `ChannelConfig::accept_underpaying_htlcs`). This
use case is in particular useful for the LSPS2/JIT channel setting where
the intial underpaying HTLC pays for the channel open.

While we previously exposed the withheld amount as
`PaymentClaimable::counterparty_skimmed_fee_msat` on the receiver side,
we did not individually provide it on the forwarding node's side.
Here, we therefore expose this additionally withheld amount via
`PaymentForwarded::skimmed_fee_msat`.

3 months agoMerge pull request #2864 from dunxen/2024-01-2797followups
dunxen [Thu, 1 Feb 2024 08:19:13 +0000 (10:19 +0200)]
Merge pull request #2864 from dunxen/2024-01-2797followups

Fix followups to PR2797

3 months agoAdd tests to check the introduced behaviour
shaavan [Wed, 31 Jan 2024 12:14:58 +0000 (17:44 +0530)]
Add tests to check the introduced behaviour

- The first test make sure that the OutboundV1Channel is not
immediately removed when peers disconnect, but is removed after N timer
ticks.
- The second test makes sure that the SendOpenChannel is rebroadcasted
for the OutboundV1Channel if peer reconnects within time.

3 months agoDo not remove Outbound Channel immediately when peer disconnects
shaavan [Sun, 10 Dec 2023 12:47:32 +0000 (18:17 +0530)]
Do not remove Outbound Channel immediately when peer disconnects

- Do not remove channel immediately when peer_disconnect, instead
  removed it after some time if peer doesn't reconnect soon (handled in
previous commit).
- Do not mark per ok_to_remove if we have some OutboundV1Channels too.
- Rebroadcast SendOpenChannel for outboundV1Channel when peer
  reconnects.
- Update the relevant tests to account for the behavior change.
- Repurpose the test_disconnect_in_funding_batch to test that all
  channels in the batch close when one them closes.

3 months agoRename `PaymentForwarded::fee_earned_msat` to `total_fee_earned_msat`
Elias Rohrer [Tue, 30 Jan 2024 08:18:28 +0000 (09:18 +0100)]
Rename `PaymentForwarded::fee_earned_msat` to `total_fee_earned_msat`

3 months agoTrack min HTLC overpay separately from skimmed fees in test utils
Valentine Wallace [Tue, 30 Jan 2024 19:43:59 +0000 (14:43 -0500)]
Track min HTLC overpay separately from skimmed fees in test utils

3 months agoStruct-ify claim_along_route args.
Valentine Wallace [Wed, 20 Dec 2023 20:45:34 +0000 (15:45 -0500)]
Struct-ify claim_along_route args.

Lays groundwork to make claim_payment* test utils easier to adapt without
changing a million callsites.

3 months agoFix followups to PR2797
Duncan Dean [Wed, 31 Jan 2024 05:58:56 +0000 (07:58 +0200)]
Fix followups to PR2797

3 months ago[bindings] Move additional score params from `&()` to `Default` 2024-01-bindings-upstream
Matt Corallo [Tue, 23 Jan 2024 06:19:24 +0000 (06:19 +0000)]
[bindings] Move additional score params from `&()` to `Default`

In 26c1639ab69d6780c97a118f09e42cb42304088a (and later in
50c55dcf32466e3ccf17acea50697fc664950deb) we switched to using
`Default::default()` to initialize `()` for scoring parameters in
tests. A number of `()`s slipped back in recently, which we replace
here.

3 months agoDrop manual `Debug` impl on RGS' `GraphSyncError`
Matt Corallo [Tue, 23 Jan 2024 19:20:05 +0000 (19:20 +0000)]
Drop manual `Debug` impl on RGS' `GraphSyncError`

As it does the same thing as a derived `Debug` does anyway.

3 months agoMove RGS `GraphSyncError` into the top-level module
Matt Corallo [Thu, 18 Jan 2024 20:53:20 +0000 (20:53 +0000)]
Move RGS `GraphSyncError` into the top-level module

The top-level module is only a few hundred lines, so there's not a
lot of reason to hide the `GraphSyncError` in its own module.
Instead, we simply move it to the top-level `lib.rs`, which doesn't
change the public API as it was previously re-exported at the top
level.

3 months agoStore `EntropySource` in `DefaultRouter` instead of passing it
Matt Corallo [Tue, 23 Jan 2024 19:49:36 +0000 (19:49 +0000)]
Store `EntropySource` in `DefaultRouter` instead of passing it

...as an arg to `Router`. Passing an `EntropySource` around all
the time is a bit strange as the `Router` may or may not actually
use it, and the `DefaultRouter` can just as easily store it.

3 months agoFix `three_hop_blinded_path_success` with different randomization
Matt Corallo [Tue, 30 Jan 2024 23:54:56 +0000 (23:54 +0000)]
Fix `three_hop_blinded_path_success` with different randomization

In `three_hop_blinded_path_success`, the nodes in the test ended up
at radically different block heights after channel opening. At that
point, if the CLTV randomization is done slightly different the
test payment may fail, which we fix here by ensuring all nodes are
at the same height before we go to send a payment.

3 months agoMerge pull request #2862 from arik-so/arik/2024/01/http-error-message-fix
Matt Corallo [Tue, 30 Jan 2024 23:36:36 +0000 (23:36 +0000)]
Merge pull request #2862 from arik-so/arik/2024/01/http-error-message-fix

Improve error message for invalid response lengths

3 months agoMerge pull request #2780 from wpaulino/2691-follow-ups
Matt Corallo [Tue, 30 Jan 2024 23:21:42 +0000 (23:21 +0000)]
Merge pull request #2780 from wpaulino/2691-follow-ups

2691 follow-ups

3 months agoMerge pull request #2797 from dunxen/2023-12-purgetochannelid
Matt Corallo [Tue, 30 Jan 2024 23:04:39 +0000 (23:04 +0000)]
Merge pull request #2797 from dunxen/2023-12-purgetochannelid

Remove `Outpoint::to_channel_id` method

3 months agoImprove error message for invalid response lengths.
Arik Sosman [Tue, 30 Jan 2024 19:43:04 +0000 (11:43 -0800)]
Improve error message for invalid response lengths.

3 months agoRemove `Outpoint::to_channel_id` method
Duncan Dean [Tue, 9 Jan 2024 07:07:01 +0000 (09:07 +0200)]
Remove `Outpoint::to_channel_id` method

To avoid confusion and for accuracy going forward, we remove this method
as it is inconsistent with channel IDs generated during V2 channel
establishment. If one wants to create a V1, funding outpoint-based
channel ID, then `ChannelId::v1_from_funding_outpoint` should be used
instead.

A large portion of the library has always made the assumption that having
the funding outpoint will always allow us to generate the channel ID.
This will not be the case anymore and we need to pass the channel ID along
where appropriate. All channels that could have been persisted up to this
point could only have used V1 establishment, so if some structures don't
store a channel ID for them they can safely fall back to the funding
outpoint-based version.

3 months agoEnforce compile-time check for flag getters and setters
Wilmer Paulino [Fri, 8 Dec 2023 19:33:06 +0000 (11:33 -0800)]
Enforce compile-time check for flag getters and setters

This ensures that we cannot define or use flag getters/setters on
`ChannelState` variants in which said flag is not valid.

3 months agoUse clear helper on flags copy to mask off bits
Wilmer Paulino [Mon, 29 Jan 2024 21:57:19 +0000 (13:57 -0800)]
Use clear helper on flags copy to mask off bits

3 months agoMerge pull request #2694 from Evanfeenstra/public-scid-utils
Matt Corallo [Thu, 25 Jan 2024 01:52:13 +0000 (01:52 +0000)]
Merge pull request #2694 from Evanfeenstra/public-scid-utils

public scid utils

3 months ago[bindings] No-export `RouteHopCandidate` lifetime'd fields
Matt Corallo [Tue, 23 Jan 2024 01:16:46 +0000 (01:16 +0000)]
[bindings] No-export `RouteHopCandidate` lifetime'd fields

The bindings cannot express lifetimes, so exposing any field which
is a reference (and not `clone`-able, at least for garbage
collected language bindings) is unsafe for those expecting a
high-level interface.

Thus, we simply no-export the `RouteHopCandidate` inner struct
fields which are references (there are relevant accessors for them
anyway).

3 months ago[bindings] Mark `WithContext` log wrapper with no-export
Matt Corallo [Thu, 18 Jan 2024 00:42:55 +0000 (00:42 +0000)]
[bindings] Mark `WithContext` log wrapper with no-export

There's not a lot of reason for downstream users to use the
`WithContext` wrapper, it mostly exists for our own downstream
crates anyway, and dealing with lifetimes in bindings isn't super
practical, so simply no-export it.

3 months ago[bindings] Drop the lifetime bound on `Record` for bindings builds
Matt Corallo [Wed, 20 Dec 2023 05:17:43 +0000 (05:17 +0000)]
[bindings] Drop the lifetime bound on `Record` for bindings builds

Because log `Record`s are now being passed by ownership to `log`,
the bindings get quite annoyed that there's a lifetime hanging
around. We already don't use this lifetime in bindings (the
`FormatArgs` is converted to a string and stored on the heap), so
we can just drop the lifetime, even though it requires some
macro'ing of the struct definition to do so.

3 months agoMerge pull request #2697 from jkczyz/2023-10-offer-functional-tests
Matt Corallo [Wed, 24 Jan 2024 23:14:01 +0000 (23:14 +0000)]
Merge pull request #2697 from jkczyz/2023-10-offer-functional-tests

Functional tests for BOLT 12 Offers payment flow

3 months agoMerge pull request #2844 from TheBlueMatt/2024-01-cut-121 v0.0.121
Matt Corallo [Mon, 22 Jan 2024 23:55:35 +0000 (23:55 +0000)]
Merge pull request #2844 from TheBlueMatt/2024-01-cut-121

Release 0.0.121

3 months agoBump versions to LDK 0.0.121/invoice 0.29 2024-01-cut-121
Matt Corallo [Mon, 22 Jan 2024 22:22:20 +0000 (22:22 +0000)]
Bump versions to LDK 0.0.121/invoice 0.29

3 months agoAdd CHANGELOG entry for 0.0.121
Matt Corallo [Mon, 22 Jan 2024 22:21:16 +0000 (22:21 +0000)]
Add CHANGELOG entry for 0.0.121

3 months agoMerge pull request #2841 from TheBlueMatt/2024-01-batch-deadlock
Matt Corallo [Mon, 22 Jan 2024 22:30:59 +0000 (22:30 +0000)]
Merge pull request #2841 from TheBlueMatt/2024-01-batch-deadlock

Fix deadlock when handling bad calls to `batch_funding.._generated`

3 months agoMerge pull request #2842 from jkczyz/2024-01-fix-peer-handler-unwrap
Matt Corallo [Mon, 22 Jan 2024 22:30:56 +0000 (22:30 +0000)]
Merge pull request #2842 from jkczyz/2024-01-fix-peer-handler-unwrap

Fix panic when peer is mid-handshake

3 months agoRemove unnecessary unwraps
Jeffrey Czyz [Mon, 22 Jan 2024 22:26:54 +0000 (16:26 -0600)]
Remove unnecessary unwraps

3 months agoFix panic when peer is mid-handshake
Jeffrey Czyz [Thu, 18 Jan 2024 21:34:19 +0000 (15:34 -0600)]
Fix panic when peer is mid-handshake

Peer::their_node_id is set to Some during the handshake process.
However, df3ab2ee2753e7f9ec02ddf1c8a51db77c50e35d accesses the field
unconditionally, causing a panic. This may be triggered if a gossip
message is received mid-handshake from another peer or if the user calls
broadcast_node_announcement during this time. The latter tends to be
executed on a timer.

Ensure that Peer::their_node_id is only accessed once the handshake is
complete.

3 months agoFix deadlock when handling bad calls to `batch_funding.._generated` 2024-01-batch-deadlock
Matt Corallo [Mon, 22 Jan 2024 20:26:32 +0000 (20:26 +0000)]
Fix deadlock when handling bad calls to `batch_funding.._generated`

When handling calls to `batch_funding_transaction_generated` which
were missing outputs for one of the batch channels, we'd previously
deadlock when trying to clean up the now-closed channels. This
fixes that and adds a new test case for it.

Found by the full_stack_target fuzzer.

3 months agopublic scid utils
Evan Feenstra [Sat, 28 Oct 2023 15:38:17 +0000 (08:38 -0700)]
public scid utils