]> git.bitcoin.ninja Git - rust-lightning/log
rust-lightning
8 weeks agoMerge pull request #3185 from tnull/2024-07-clarify-max-description-length
Matt Corallo [Tue, 16 Jul 2024 15:24:45 +0000 (08:24 -0700)]
Merge pull request #3185 from tnull/2024-07-clarify-max-description-length

Clarify maximum length of an invoice description

2 months agoMerge pull request #3183 from TheBlueMatt/2024-07-no-strict
Matt Corallo [Tue, 16 Jul 2024 13:31:52 +0000 (06:31 -0700)]
Merge pull request #3183 from TheBlueMatt/2024-07-no-strict

Drop unnecessary `strict` feature from `lightning-invoice`

2 months agoMerge pull request #3150 from alecchendev/2024-06-async-commit-point-raa
Matt Corallo [Tue, 16 Jul 2024 13:30:57 +0000 (06:30 -0700)]
Merge pull request #3150 from alecchendev/2024-06-async-commit-point-raa

Handle fallible per commitment point for RAA

2 months agoClarify maximum length of an invoice description
Elias Rohrer [Tue, 16 Jul 2024 08:28:58 +0000 (10:28 +0200)]
Clarify maximum length of an invoice description

We previously stated in the docs that the invoice description can be at most `1023`
bytes long, which is wrong. According to BOLT 11 it's at most 1023*5 bits (639 bytes) long.

2 months agoTest async get per commitment point for revoke_and_ack
Alec Chen [Sun, 30 Jun 2024 23:05:48 +0000 (16:05 -0700)]
Test async get per commitment point for revoke_and_ack

Note: this does not test the CS -> RAA resend ordering, because this
requires handling async get_per_commitment_point for channel
reestablishment, which will be addressed in a follow up PR.

2 months agoAllow failing revoke_and_ack if commitment point is not available
Alec Chen [Sat, 29 Jun 2024 22:41:27 +0000 (15:41 -0700)]
Allow failing revoke_and_ack if commitment point is not available

2 months agoChange get_per_commitment_point to return result type
Alec Chen [Wed, 5 Jun 2024 22:40:38 +0000 (17:40 -0500)]
Change get_per_commitment_point to return result type

Includes simple changes to test util signers and tests, as well as
handling the error case for get_per_commitment_point in
HolderCommitmentPoint. This leaves a couple `.expect`s in places
that will be addressed in a separate PR for handling funding.

2 months agoMerge pull request #3165 from Harshit933/link-fix
Matt Corallo [Mon, 15 Jul 2024 19:17:09 +0000 (12:17 -0700)]
Merge pull request #3165 from Harshit933/link-fix

Fixes `Sensei` broken link

2 months agoAdd logger as parameter in creating ChannelContext
Alec Chen [Thu, 30 May 2024 20:25:29 +0000 (15:25 -0500)]
Add logger as parameter in creating ChannelContext

2 months agoReturn an error if we fail to advance our commitment number
Alec Chen [Tue, 18 Jun 2024 21:48:23 +0000 (14:48 -0700)]
Return an error if we fail to advance our commitment number

2 months agoDrop unnecessary `strict` feature from `lightning-invoice` 2024-07-no-strict
Matt Corallo [Mon, 15 Jul 2024 18:34:04 +0000 (18:34 +0000)]
Drop unnecessary `strict` feature from `lightning-invoice`

99aa6e27f616c96dda2b49d09bafbc0b982251e0 detected that we had an
undefined feature in `lightning-invoice` called `strict`, which was
used to turn on `deny(warnings)`. It resolved that by adding the
feature to the `Cargo.toml`, but we actually don't need it - our CI
already builds with `-Dwarnings`, so any warnings should be
rejected during CI and there's not a lot of value in having a
(public) feature to do the same.

2 months agoMerge pull request #3173 from dunxen/2024-07-cargocheckcfg
Matt Corallo [Mon, 15 Jul 2024 18:33:08 +0000 (11:33 -0700)]
Merge pull request #3173 from dunxen/2024-07-cargocheckcfg

Use native check-cfg lint in cargo beta

2 months agoSplit HolderCommitmentPoint::advance off into separate function
Alec Chen [Tue, 18 Jun 2024 21:26:25 +0000 (14:26 -0700)]
Split HolderCommitmentPoint::advance off into separate function

2 months agoMerge pull request #3180 from tnull/2024-07-use-upstreamed-merkle-validation
Matt Corallo [Mon, 15 Jul 2024 18:16:40 +0000 (11:16 -0700)]
Merge pull request #3180 from tnull/2024-07-use-upstreamed-merkle-validation

Electrum: Use upstreamed `validate_merkle_proof`

2 months agoMerge pull request #3172 from tnull/2024-07-revert-gossip-query-patch
valentinewallace [Mon, 15 Jul 2024 17:39:54 +0000 (13:39 -0400)]
Merge pull request #3172 from tnull/2024-07-revert-gossip-query-patch

Revert "Signal `GossipQuery` support when using `IgnoringMessagHandler`"

2 months agoUse upstreamed `validate_merkle_proof`
Elias Rohrer [Mon, 15 Jul 2024 11:43:22 +0000 (13:43 +0200)]
Use upstreamed `validate_merkle_proof`

We previously upstreamed the `validate_merkle_proof` utility method,
which shipped with `electrum-client` 0.19.0.

Since we upgraded to that version recently, we can now drop our local
code and use the upstreamed version.

2 months agoMerge pull request #3138 from tnull/2024-06-rustfmt-bp
Matt Corallo [Sun, 14 Jul 2024 18:15:13 +0000 (11:15 -0700)]
Merge pull request #3138 from tnull/2024-06-rustfmt-bp

`rustfmt`: Run on `lightning-background-processor`

2 months agoFixes `Sensei` broken link
Harshit Verma [Tue, 9 Jul 2024 17:24:14 +0000 (22:54 +0530)]
Fixes `Sensei` broken link

Issue: https://github.com/lightningdevkit/rust-lightning/issues/3148

2 months agoUse native check-cfg lint in cargo beta
Duncan Dean [Fri, 12 Jul 2024 09:23:50 +0000 (11:23 +0200)]
Use native check-cfg lint in cargo beta

This uses the newly introduced conditional configuration checks that are
now configurable withint Cargo (beta).

This allows us to get rid of our custom python script that checks for
expected features and cfgs.

This does introduce a warning regarding the unknown lint in Cargo
versions prior to the current beta, but since these are not rustc errors,
they won't break any builds with the "-D warnings" RUSTFLAG.

Moving to this lint actually exposed the "strict" feature not being
present in the lightning-invoice crate, as our python script didnt
correctly parse the cfg_attr where it appeared.

2 months agoRevert "Signal `GossipQuery` support when using `IgnoringMessagHandler`"
Elias Rohrer [Fri, 12 Jul 2024 08:49:16 +0000 (10:49 +0200)]
Revert "Signal `GossipQuery` support when using `IgnoringMessagHandler`"

This reverts commit 843079df72435b8a117e8b12b42492391409259f.

2 months agoMerge pull request #3104 from TheBlueMatt/2024-06-routing-counters
valentinewallace [Wed, 10 Jul 2024 14:03:53 +0000 (10:03 -0400)]
Merge pull request #3104 from TheBlueMatt/2024-06-routing-counters

2 months agoMove blinded path introduction point resolution to a helper method 2024-06-routing-counters
Matt Corallo [Wed, 10 Jul 2024 01:22:32 +0000 (01:22 +0000)]
Move blinded path introduction point resolution to a helper method

This marginally reduces the size of `get_route` by moving a the
blinded path introduction point resolution and blinded path checks
into a helper method.

2 months agoAlign `PathBuildingHop` to 128b, now that we store them in a `Vec`
Matt Corallo [Thu, 7 Dec 2023 23:40:26 +0000 (23:40 +0000)]
Align `PathBuildingHop` to 128b, now that we store them in a `Vec`

Now that `PathBuildingHop` is stored in a `Vec` (as `Option`s),
rather than `HashMap` entries, they can grow to fill a full two
cache lines without a memory access performance cost. In the next
commit we'll take advantage of this somewhat, but here we update
the assertions and drop the `repr(C)`, allowing rust to lay the
memory out as it wishes.

2 months agoDrop the `dist` `HashMap` in routing, replacing it with a `Vec`.
Matt Corallo [Mon, 24 Jun 2024 23:50:29 +0000 (23:50 +0000)]
Drop the `dist` `HashMap` in routing, replacing it with a `Vec`.

Now that we have unique, dense, 32-bit identifiers for all the
nodes in our network graph, we can store the per-node information
when routing in a simple `Vec` rather than a `HashMap`. This avoids
the overhead of hashing and table scanning entirely, for a nice
"simple" optimization win.

2 months agoUse `NodeCounters` `NodeId`s as the blinded path intro references
Matt Corallo [Sat, 1 Jun 2024 22:45:04 +0000 (22:45 +0000)]
Use `NodeCounters` `NodeId`s as the blinded path intro references

The router's `introduction_node_id_cache` is used to cache the
`NodeId`s of blinded path introduction points so that we don't
have to look them up every time we go around the main router loop.
When using it, if the introduction point isn't a public node we
then look up the introduction in our first-hops map.

In either case, we have to end up with a reference to a `NodeId`
that outlives our `dist` map.

Here we consolidate both the initial cache building and the
first-hops map lookup to one place, storing only a reference to a
`NodeId` either in the `NetworkGraph` or in the new `NodeCounters`
to get the required lifetime without needing to reference into the
first-hops map.

We then take this opportunity to avoid `clone`ing the first-hops
map entries as we now no longer reference into it.

2 months agoDrop `private_hop_key_cache` in favor of `NodeCounters`
Matt Corallo [Sat, 1 Jun 2024 18:19:45 +0000 (18:19 +0000)]
Drop `private_hop_key_cache` in favor of `NodeCounters`

With the new `NodeCounters` have have a all the `NodeId`s we'll
need during routing, so there's no need to keep the
`private_hop_key_cache` which existed to provide references to
`NodeId`s which are needed during routing.

2 months agoAdd a new `NodeCounters` utility to track counters when routing
Matt Corallo [Tue, 19 Mar 2024 19:29:06 +0000 (19:29 +0000)]
Add a new `NodeCounters` utility to track counters when routing

In the next commit we'll stop using `NodeId`s to look up nodes when
routing, instead using the new per-node counters. Here we take the
first step, adding a local struct which tracks temporary counters
for route hints/source/destination nodes.

Because we must ensure we have a 1-to-1 mapping from node ids to
`node_counter`s, even across first-hop and last-hop hints, we have
to be careful to check the network graph first, then a new
`private_node_id_to_node_counter` map to ensure we only ever end up
with one counter per node id.

2 months agoMerge pull request #3085 from shaavan/issue2837
Matt Corallo [Tue, 9 Jul 2024 16:16:15 +0000 (09:16 -0700)]
Merge pull request #3085 from shaavan/issue2837

Introduce RecipientData and use it to allow abandon failed payments

2 months agoMerge pull request #3161 from vincenzopalazzo/macros/fix-docs
Matt Corallo [Tue, 9 Jul 2024 15:28:07 +0000 (08:28 -0700)]
Merge pull request #3161 from vincenzopalazzo/macros/fix-docs

meta: update docs to reflect the code

2 months agometa: update docs to reflect the code
Vincenzo Palazzo [Tue, 9 Jul 2024 10:00:56 +0000 (12:00 +0200)]
meta: update docs to reflect the code

The code documentation is outdated after the commit 935a716cc6c4fada075e2b740a70bb1b7b349d49

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2 months agoMerge pull request #3149 from alecchendev/2024-06-async-sign-cs-raa-order
Matt Corallo [Tue, 9 Jul 2024 13:48:08 +0000 (06:48 -0700)]
Merge pull request #3149 from alecchendev/2024-06-async-sign-cs-raa-order

Fix bug failing CS-RAA resend order on pending commitment signatures

2 months agoAllow create_blinded_paths functions to accept MessageContext as input field
shaavan [Sat, 15 Jun 2024 13:52:56 +0000 (19:22 +0530)]
Allow create_blinded_paths functions to accept MessageContext as input field

- Enabled `create_blinded_paths` to accept `MessageContext` TLVs as
  an input field.
- `MessageContext` is intended to be sent along with the `reply_path`
   to the counterparty.
- Added `MessageContext` in the `create_blinded_paths` flow, optionally
  appending it within the `reply_path`.
- Updated tests to verify the new feature.

2 months agoUpdate handle_message to accept OffersContext data as an input field
shaavan [Sat, 15 Jun 2024 13:52:28 +0000 (19:22 +0530)]
Update handle_message to accept OffersContext data as an input field

1. Handling Offers Data:
   - Updated `handle_message` to accept `OffersContext` data as an input field.
   - If it is present, it will be utilized by the handler to
     abandon outbound payments that have failed for any reason.

2. Consistency in Custom Message Handling:
   - Updated `handle_custom_message` to accept optional custom data.
     for consistency.
   - Note: `custom_data` will remain unused in this PR.

2 months ago`rustfmt`: Run on `lightning-background-processor/src/lib.rs`
Elias Rohrer [Thu, 20 Jun 2024 12:11:14 +0000 (14:11 +0200)]
`rustfmt`: Run on `lightning-background-processor/src/lib.rs`

2 months agoPrepare `lightning-background-processor/src/lib.rs`
Elias Rohrer [Tue, 9 Jul 2024 08:19:08 +0000 (10:19 +0200)]
Prepare `lightning-background-processor/src/lib.rs`

2 months agoFix bug failing CS-RAA resend order on pending commitment signatures
Alec Chen [Sun, 30 Jun 2024 20:55:18 +0000 (13:55 -0700)]
Fix bug failing CS-RAA resend order on pending commitment signatures

2 months agoMerge pull request #3120 from TheBlueMatt/2023-11-mon-claim-bug
Matt Corallo [Mon, 8 Jul 2024 20:50:06 +0000 (13:50 -0700)]
Merge pull request #3120 from TheBlueMatt/2023-11-mon-claim-bug

Block monitor updates to ensure preimages are in each MPP part

2 months agoIntroduce MessageContext in ReceiveTlvs
shaavan [Fri, 14 Jun 2024 12:36:05 +0000 (18:06 +0530)]
Introduce MessageContext in ReceiveTlvs

1. New Enum for Enhanced Data Handling:
   - Introduced the `MessageContext` enum, which allows the node to include
     additional context data along with the `reply_path` sent to the counterparty.
   - The node anticipates receiving this data back for further processing.

2. Variants in MessageContext:
   - The `MessageContext` enum includes two variants: "Offers" and
     "Context"
   - One of the variants, `Offers`, holds the `payment_id`
     of the associated Outbound BOLT12 Payment.

3. Future Usage:
   - This enum will be utilized in a subsequent commit to abandon outbound
     payments that have failed to complete for various reasons.

2 months agoRemove path_id from Responder, and OnionMessageResponse struct
shaavan [Tue, 18 Jun 2024 17:03:02 +0000 (22:33 +0530)]
Remove path_id from Responder, and OnionMessageResponse struct

1. The path_id will be removed from the codebase in the following
   commits.

2 months agoTest the new `RAAMonitorUpdateBlockingAction::ClaimedMPPPayment` 2023-11-mon-claim-bug
Matt Corallo [Thu, 13 Jun 2024 01:26:08 +0000 (01:26 +0000)]
Test the new `RAAMonitorUpdateBlockingAction::ClaimedMPPPayment`

2 months agoBlock monitor updates to ensure preimages are in each MPP part
Matt Corallo [Thu, 13 Jun 2024 00:29:01 +0000 (00:29 +0000)]
Block monitor updates to ensure preimages are in each MPP part

If we claim an MPP payment and only persist some of the
`ChannelMonitorUpdate`s which include the preimage prior to
shutting down, we may be in a state where some of our
`ChannelMonitor`s have the preimage for a payment while others do
not.

This, it turns out, is actually mostly safe - on startup
`ChanelManager` will detect there's a payment it has as unclaimed
but there's a corresponding payment preimage in a `ChannelMonitor`
and go claim the other MPP parts. This works so long as the
`ChannelManager` has been persisted after the payment has been
received but prior to the `PaymentClaimable` event being processed
(and the claim itself occurring). This is not always true and
certainly not required on our API, but our
`lightning-background-processor` today does persist prior to event
handling so is generally true subject to some race conditions.

In order to address this we need to use copy payment preimages
across channels irrespective of the `ChannelManager`'s payment
state, but this introduces another wrinkle - if one channel makes
substantial progress while other channel(s) are still waiting to
get the payment preimage in `ChannelMonitor`(s) while the
`ChannelManager` hasn't been persisted after the payment was
received, we may end up without the preimage on disk.

Here, we address this issue by using the new
`RAAMonitorUpdateBlockingAction` variant for this specific case. We
block persistence of an RAA `ChannelMonitorUpdate` which may remove
the preimage from disk until all channels have had the preimage
added to their `ChannelMonitor`.

We do this only in-memory (and not on disk) as we can recreate this
blocker during the startup re-claim logic.

This will enable us to claim MPP parts without using the
`ChannelManager`'s payment state in later work.

2 months agoAdd a `RAAMonitorUpdateBlockingAction::ClaimedMPPPayment`
Matt Corallo [Tue, 14 May 2024 00:03:39 +0000 (00:03 +0000)]
Add a `RAAMonitorUpdateBlockingAction::ClaimedMPPPayment`

If we claim an MPP payment and only persist some of the
`ChannelMonitorUpdate`s which include the preimage prior to
shutting down, we may be in a state where some of our
`ChannelMonitor`s have the preimage for a payment while others do
not.

This, it turns out, is actually mostly safe - on startup
`ChanelManager` will detect there's a payment it has as unclaimed
but there's a corresponding payment preimage in a `ChannelMonitor`
and go claim the other MPP parts. This works so long as the
`ChannelManager` has been persisted after the payment has been
received but prior to the `PaymentClaimable` event being processed
(and the claim itself occurring). This is not always true and
certainly not required on our API, but our
`lightning-background-processor` today does persist prior to event
handling so is generally true subject to some race conditions.

In order to address this race we need to use copy payment preimages
across channels irrespective of the `ChannelManager`'s payment
state, but this introduces another wrinkle - if one channel makes
substantial progress while other channel(s) are still waiting to
get the payment preimage in `ChannelMonitor`(s) while the
`ChannelManager` hasn't been persisted after the payment was
received, we may end up without the preimage on disk.

Here, we address this issue with a new
`RAAMonitorUpdateBlockingAction` variant for this specific case. We
block persistence of an RAA `ChannelMonitorUpdate` which may remove
the preimage from disk until all channels have had the preimage
added to their `ChannelMonitor`.

We do this only in-memory (and not on disk) as we can recreate this
blocker during the startup re-claim logic.

This will enable us to claim MPP parts without using the
`ChannelManager`'s payment state in later work.

2 months agoTrack the cp `node_id` which originated an HTLC in the `HTLCSource`
Matt Corallo [Wed, 12 Jun 2024 20:49:07 +0000 (20:49 +0000)]
Track the cp `node_id` which originated an HTLC in the `HTLCSource`

Because we track pending `ChannelMonitorUpdate`s per-peer, we
really need to know what peer an HTLC came from when we go to claim
it on-chain, allowing us to look up any blocked actions in the
`PeerState`. While we could do this by moving the blocked actions
to some global "closed-channel update queue", its simpler to do it
this way.

While this trades off `ChannelMonitorUpdate` size somewhat (the
`HTLCSource` is included in many of them), which we should be
sensitive to, it will also allow us to (eventually) remove the
SCID -> peer + channel_id lookups we do when claiming or failing
today, which are somewhat annoying to deal with.

2 months agoAdd skipping variants to `impl_writeable_tlv_based_enum_upgradable`
Matt Corallo [Tue, 18 Jun 2024 17:24:21 +0000 (17:24 +0000)]
Add skipping variants to `impl_writeable_tlv_based_enum_upgradable`

In some cases, we have variants of an enum serialized using
`impl_writeable_tlv_based_enum_upgradable` which we don't want to
write/read. Here we add support for such variants by writing them
using the (odd) type 255 without any contents and using
`MaybeReadable` to decline to read them.

2 months agoMerge pull request #3151 from alecchendev/2024-06-async-test-util-followup
Matt Corallo [Mon, 8 Jul 2024 18:28:16 +0000 (11:28 -0700)]
Merge pull request #3151 from alecchendev/2024-06-async-test-util-followup

Async signing test util follow ups

2 months agoMerge pull request #3156 from valentinewallace/2024-07-b12-max-path-len
valentinewallace [Mon, 8 Jul 2024 16:45:20 +0000 (12:45 -0400)]
Merge pull request #3156 from valentinewallace/2024-07-b12-max-path-len

Set max path length when paying BOLT 12 invoices.

2 months agoSet max path length when paying BOLT 12 invoices.
Valentine Wallace [Wed, 3 Jul 2024 18:31:33 +0000 (14:31 -0400)]
Set max path length when paying BOLT 12 invoices.

2 months agoMerge pull request #3158 from dunxen/2024-07-excludemergesfrommutants
Elias Rohrer [Mon, 8 Jul 2024 08:06:43 +0000 (10:06 +0200)]
Merge pull request #3158 from dunxen/2024-07-excludemergesfrommutants

Skip incremental-mutants job for main

2 months agoFix CI for unused `PendingOnionMessage`
Duncan Dean [Thu, 4 Jul 2024 15:08:16 +0000 (17:08 +0200)]
Fix CI for unused `PendingOnionMessage`

2 months agoSkip incremental-mutants job for main
Duncan Dean [Thu, 4 Jul 2024 13:48:01 +0000 (15:48 +0200)]
Skip incremental-mutants job for main

There is no diff when running against main, so we skip incremental-mutants.
Before this commit, we'd get `Error: Failed to parse diff: Line 1: Error while parsing:`
as the diff file was empty.

2 months agoTest router: support expecting blinded payment paths.
Valentine Wallace [Wed, 3 Jul 2024 18:31:13 +0000 (14:31 -0400)]
Test router: support expecting blinded payment paths.

2 months agoRemove spurious commented out code line.
Valentine Wallace [Wed, 3 Jul 2024 18:28:11 +0000 (14:28 -0400)]
Remove spurious commented out code line.

2 months agoMerge pull request #3154 from TheBlueMatt/2024-06-message-flags
Elias Rohrer [Wed, 3 Jul 2024 07:15:37 +0000 (03:15 -0400)]
Merge pull request #3154 from TheBlueMatt/2024-06-message-flags

Fix spelling in comment

2 months agoAllow sending RAA upon unblocking the signer
Alec Chen [Sun, 30 Jun 2024 20:54:20 +0000 (13:54 -0700)]
Allow sending RAA upon unblocking the signer

2 months agoFix spelling in comment 2024-06-message-flags
Matt Corallo [Tue, 2 Jul 2024 22:17:02 +0000 (22:17 +0000)]
Fix spelling in comment

From @valentinewallace at
https://github.com/lightningdevkit/rust-lightning/pull/3144#discussion_r1661404243

2 months agoMerge pull request #3144 from TheBlueMatt/2024-06-message-flags
Matt Corallo [Tue, 2 Jul 2024 22:16:59 +0000 (15:16 -0700)]
Merge pull request #3144 from TheBlueMatt/2024-06-message-flags

(Re-)add handling for `ChannelUpdate::message_flags`

2 months agoUse `test_msg_exact` in `channl_update` fuzz testing
Matt Corallo [Tue, 25 Jun 2024 16:33:47 +0000 (16:33 +0000)]
Use `test_msg_exact` in `channl_update` fuzz testing

Gossip messages should always use `test_msg_exact` to ensure they
round-trip during signature validation.

2 months ago(Re-)add handling for `ChannelUpdate::message_flags`
Matt Corallo [Tue, 25 Jun 2024 16:20:59 +0000 (16:20 +0000)]
(Re-)add handling for `ChannelUpdate::message_flags`

When the `htlc_maximum_msat` field was made mandatory in
`ChannelUpdate` (in b0e8b739b73cc25f3e1ab00695a14d972162a140) we
started ignoring the `message_flags` field entirely and always
writing `1`. The comment updates indicated that the `message_flags`
field was deprecated, but this is not true - only the
`htlc_maximum_msat` indicator bit was deprecated, requiring it to
be 1.

If a node creates a `channel_update` with `message_flags` bits set
other than the low bit, this will cause us to spuriously reject
the message with an invalid signature error as we will check the
message against the wrong hash.

With today's current spec this is totally fine - the only other bit
defined for `message_flags` is the `dont_forward` bit, which when
set indicates we shouldn't accept the message into our gossip store
anyway (though this may lead to spurious `warning` messages being
sent to peers). However, in the future this may mean we start
rejecting valid `channel_update`s if new bits are defiend.

2 months agoAsync signing test util follow ups
Alec Chen [Tue, 18 Jun 2024 18:01:59 +0000 (11:01 -0700)]
Async signing test util follow ups

- Remove unused unavailable signers in TestKeysInterface
- Remove unnecessary display implementation for SignerOp
- Move set of test disabled signer ops to EnforcementState
- Add method to enable/disable all signer ops at once

2 months agoMerge pull request #2763 from dunxen/2023-11-mutation-testing
Matt Corallo [Mon, 1 Jul 2024 17:40:17 +0000 (10:40 -0700)]
Merge pull request #2763 from dunxen/2023-11-mutation-testing

Introduce mutation testing

2 months agoIntroduce basic incremental mutation testing
Duncan Dean [Thu, 30 Nov 2023 11:31:24 +0000 (13:31 +0200)]
Introduce basic incremental mutation testing

We introduce a CI job for mutation testing of PR diffs using cargo-mutants.
Missed cases do not trigger a fail of this job yet as we just introduce it
now for visibility. We may start enforcing stricter rules at a later stage.

2 months agoMerge pull request #3129 from optout21/splicing-msgs-update
Jeffrey Czyz [Thu, 27 Jun 2024 19:39:26 +0000 (14:39 -0500)]
Merge pull request #3129 from optout21/splicing-msgs-update

Update splice messages according to new spec draft

2 months agoMerge pull request #3147 from TheBlueMatt/2024-06-feerate-overflow
Elias Rohrer [Thu, 27 Jun 2024 15:03:24 +0000 (11:03 -0400)]
Merge pull request #3147 from TheBlueMatt/2024-06-feerate-overflow

Handle feerates of `u32::MAX` without overflowing

2 months agoMerge pull request #2989 from optout21/iatx-shared-output
dunxen [Thu, 27 Jun 2024 08:37:39 +0000 (10:37 +0200)]
Merge pull request #2989 from optout21/iatx-shared-output

Interactive TX negotiation tracks shared outputs

2 months agoHandle feerates of `u32::MAX` without overflowing 2024-06-feerate-overflow
Matt Corallo [Wed, 26 Jun 2024 14:16:50 +0000 (14:16 +0000)]
Handle feerates of `u32::MAX` without overflowing

Though we generally shouldn't be seeing these, and the
`get_dust_buffer_feerate` implementation will still return
`u32::MAX` in spite of the overflow, we should handle the overflow
to avoid panic when `debug_assertions` are enabled.

Found by the `full_stack_target` fuzzer

2 months agoMerge pull request #3145 from valentinewallace/2024-06-AP-prefactor-followup
valentinewallace [Wed, 26 Jun 2024 14:19:22 +0000 (10:19 -0400)]
Merge pull request #3145 from valentinewallace/2024-06-AP-prefactor-followup

Followups to #3125

2 months agoImplement AsyncPaymentsMessageHandler for ChanMan and use everywhere
Valentine Wallace [Tue, 25 Jun 2024 20:17:48 +0000 (16:17 -0400)]
Implement AsyncPaymentsMessageHandler for ChanMan and use everywhere

Dummy implementation for now. This avoids having to change a bunch of type
signatures in the future when we replace the dummy impl with a real one.

2 months agoOnion message fuzzer: update held_htlc_available handling
Valentine Wallace [Tue, 25 Jun 2024 19:51:03 +0000 (15:51 -0400)]
Onion message fuzzer: update held_htlc_available handling

Fuzzers should always do more, not less. Post-merge feedback on
e8f154dd3c299c7988762909df48b0c9d919d6f8.

2 months agoMerge pull request #3125 from valentinewallace/2024-06-async-payments-prefactor
valentinewallace [Mon, 24 Jun 2024 16:06:17 +0000 (12:06 -0400)]
Merge pull request #3125 from valentinewallace/2024-06-async-payments-prefactor

Async payments message encoding and prefactor

2 months agoUpdate splice messages according to new spec draft
optout [Mon, 24 Jun 2024 11:05:45 +0000 (13:05 +0200)]
Update splice messages according to new spec draft

2 months agoCfg-gate async payments module and public enum variants.
Valentine Wallace [Thu, 13 Jun 2024 18:09:12 +0000 (14:09 -0400)]
Cfg-gate async payments module and public enum variants.

2 months agoRemove unused imports in static_invoice.rs
Valentine Wallace [Thu, 13 Jun 2024 18:08:03 +0000 (14:08 -0400)]
Remove unused imports in static_invoice.rs

2 months agoAdd OffersMessage variant for static invoices.
Valentine Wallace [Wed, 29 May 2024 18:48:05 +0000 (14:48 -0400)]
Add OffersMessage variant for static invoices.

2 months agoDRY responder instantiation for onion messages.
Valentine Wallace [Thu, 6 Jun 2024 15:56:37 +0000 (11:56 -0400)]
DRY responder instantiation for onion messages.

2 months agoAsyncPaymentsMessageHandler trait for OnionMessenger
Valentine Wallace [Wed, 5 Jun 2024 20:00:18 +0000 (16:00 -0400)]
AsyncPaymentsMessageHandler trait for OnionMessenger

Add a trait for handling async payments messages to OnionMessenger. This allows
users to either provide their own custom handling for async payments messages
or rely on a version provided by LDK.

2 months agoMerge pull request #2966 from G8XSU/2647-distribute
Matt Corallo [Thu, 20 Jun 2024 16:51:54 +0000 (09:51 -0700)]
Merge pull request #2966 from G8XSU/2647-distribute

Optimize ChannelMonitor persistence on block connections.

2 months agoInteractive TX negotiation tracks shared outputs
optout [Thu, 20 Jun 2024 15:28:56 +0000 (17:28 +0200)]
Interactive TX negotiation tracks shared outputs

2 months agoMerge pull request #3127 from wvanlint/non_strict_forwarding
Matt Corallo [Thu, 20 Jun 2024 14:26:43 +0000 (07:26 -0700)]
Merge pull request #3127 from wvanlint/non_strict_forwarding

Implement non-strict forwarding

2 months agoOnion message payload for async payments
Valentine Wallace [Wed, 5 Jun 2024 17:41:07 +0000 (13:41 -0400)]
Onion message payload for async payments

Async payments uses onion messages to indicate when HTLCs are held and
released. Add these types along with the necessary parsing and encoding.

2 months agoMerge pull request #3135 from tnull/2024-06-rustfmt-rgs
Elias Rohrer [Thu, 20 Jun 2024 11:46:06 +0000 (13:46 +0200)]
Merge pull request #3135 from tnull/2024-06-rustfmt-rgs

Run `rustfmt` on `lightning-rapid-gossip-sync`

2 months ago`rustfmt`: Drop `benches/src/bench.rs` from excluded files
Elias Rohrer [Thu, 20 Jun 2024 08:59:21 +0000 (10:59 +0200)]
`rustfmt`: Drop `benches/src/bench.rs` from excluded files

2 months ago`rustfmt`: Run on `lightning-rapid-gossip-sync/src/lib.rs`
Elias Rohrer [Thu, 20 Jun 2024 08:55:49 +0000 (10:55 +0200)]
`rustfmt`: Run on `lightning-rapid-gossip-sync/src/lib.rs`

2 months ago`rustfmt`: Run on `lightning-rapid-gossip-sync/src/processing.rs`
Elias Rohrer [Thu, 20 Jun 2024 08:54:27 +0000 (10:54 +0200)]
`rustfmt`: Run on `lightning-rapid-gossip-sync/src/processing.rs`

2 months ago`rustfmt`: Prepare `lightning-rapid-gossip-sync/src/processing.rs`
Elias Rohrer [Thu, 20 Jun 2024 08:53:29 +0000 (10:53 +0200)]
`rustfmt`: Prepare `lightning-rapid-gossip-sync/src/processing.rs`

2 months agoImplement non-strict forwarding
Willem Van Lint [Tue, 11 Jun 2024 23:05:57 +0000 (16:05 -0700)]
Implement non-strict forwarding

This change implements non-strict forwarding, allowing the node to
forward an HTLC along a channel other than the one specified
by short_channel_id in the onion message, so long as the receiver has
the same node public key intended by short_channel_id
([BOLT](https://github.com/lightning/bolts/blob/57ce4b1e05c996fa649f00dc13521f6d496a288f/04-onion-routing.md#non-strict-forwarding)).
This can improve payment reliability when there are multiple channels
with the same peer e.g. when outbound liquidity is replenished by
opening a new channel.

The implemented forwarding strategy now chooses the channel with the
lowest outbound liquidity that can forward an HTLC to maximize the
probability of being able to successfully forward a subsequent HTLC.

Fixes #1278.

2 months agoStore the source and destination `node_counter`s in `ChannelInfo`
Matt Corallo [Thu, 7 Dec 2023 04:32:06 +0000 (04:32 +0000)]
Store the source and destination `node_counter`s in `ChannelInfo`

In the next commit, we'll use the new `node_counter`s to remove a
`HashMap` from the router, using a `Vec` to store all our per-node
information. In order to make finding entries in that `Vec` cheap,
here we store the source and destintaion `node_counter`s in
`ChannelInfo`, givind us the counters for both ends of a channel
without doing a second `HashMap` lookup.

2 months agoTrack a `counter` for each node in our network graph
Matt Corallo [Thu, 7 Dec 2023 04:12:04 +0000 (04:12 +0000)]
Track a `counter` for each node in our network graph

These counters are simply a unique number describing each node.
They have no specific meaning, but start at 0 and count up, with
counters being reused after a node has been deleted.

2 months agoMerge pull request #3132 from jkczyz/2024-06-bolt12-unannounced
Elias Rohrer [Wed, 19 Jun 2024 12:42:08 +0000 (14:42 +0200)]
Merge pull request #3132 from jkczyz/2024-06-bolt12-unannounced

Blinded paths with unannounced introduction nodes

2 months agoOptimize ChannelMonitor persistence on block connections.
G8XSU [Fri, 14 Jun 2024 23:56:36 +0000 (16:56 -0700)]
Optimize ChannelMonitor persistence on block connections.

Currently, every block connection triggers the persistence of all
ChannelMonitors with an updated best_block. This approach poses
challenges for large node operators managing thousands of channels.
Furthermore, it leads to a thundering herd problem
(https://en.wikipedia.org/wiki/Thundering_herd_problem), overwhelming
the storage with simultaneous requests.

To address this issue, we now persist ChannelMonitors at a
regular cadence, spreading their persistence across blocks to
mitigate spikes in write operations.

Outcome: After doing this, Ldk's IO footprint should be reduced
by ~50 times. The processing time required to sync each block
will be significantly reduced, particularly for nodes with 1000s
of channels, as write latency plays a significant role in this process.
As a result, the Node/ChainMonitor will be blocked for a shorter
duration, leading to further efficiency gains.

2 months agoMerge pull request #3126 from TheBlueMatt/2024-06-preimage-removal-blocked-by-claim...
Gursharan Singh [Tue, 18 Jun 2024 20:31:38 +0000 (13:31 -0700)]
Merge pull request #3126 from TheBlueMatt/2024-06-preimage-removal-blocked-by-claim-event

(Very) marginally expand `test_monitor_update_fail_claim`

2 months ago(Very) marginally expand `test_monitor_update_fail_claim` 2024-06-preimage-removal-blocked-by-claim-event
Matt Corallo [Thu, 13 Jun 2024 18:59:51 +0000 (18:59 +0000)]
(Very) marginally expand `test_monitor_update_fail_claim`

For some reason I wasn't sure this happened yet, so making the
test for no-`PaymentClaimed`-event-before-preimage-on-disk explicit
is nice.

2 months agoMerge pull request #3115 from alecchendev/2024-06-specific-async-sign
Matt Corallo [Tue, 18 Jun 2024 15:33:43 +0000 (08:33 -0700)]
Merge pull request #3115 from alecchendev/2024-06-specific-async-sign

Refactor async signing test utils to toggle specific method availability

2 months agoRelax channel count check for unannounced nodes
Jeffrey Czyz [Mon, 17 Jun 2024 19:41:32 +0000 (14:41 -0500)]
Relax channel count check for unannounced nodes

When creating blinded paths, introduction nodes are limited to peers
with at least three channels to prevent easily guessing the recipient.
Relax this check when the recipient is unannounced since they won't be
in the NetworkGraph.

2 months agoAdvance self blinded payment paths
Jeffrey Czyz [Thu, 13 Jun 2024 22:15:19 +0000 (17:15 -0500)]
Advance self blinded payment paths

DefaultRouter will ignore blinded paths where the sender is the
introduction node. Similar to message paths, advance such paths by one
so that payments may be sent to them.

2 months agoRe-order imports
Jeffrey Czyz [Thu, 13 Jun 2024 19:35:21 +0000 (14:35 -0500)]
Re-order imports

2 months agoRename variable
Jeffrey Czyz [Fri, 14 Jun 2024 14:32:17 +0000 (09:32 -0500)]
Rename variable

2 months agoAdd advance_path_by_one for blinded payment paths
Jeffrey Czyz [Fri, 14 Jun 2024 21:57:41 +0000 (16:57 -0500)]
Add advance_path_by_one for blinded payment paths

Similar to blinded paths for onion messages, if given a blinded payment
path where we are the introduction node, the path must be advanced by
one in order to use it.

2 months agoDon't modify path when advance_path_by_one errors
Jeffrey Czyz [Fri, 14 Jun 2024 14:04:47 +0000 (09:04 -0500)]
Don't modify path when advance_path_by_one errors

When using advance_path_by_one when we are the introduction node, any
error will result having the first hop of the input blinded path
removed. Instead, only remove the first hop on success. Otherwise, the
path will be invalid.

2 months agoBlinded payments to unannounced introduction node
Jeffrey Czyz [Wed, 12 Jun 2024 21:54:19 +0000 (16:54 -0500)]
Blinded payments to unannounced introduction node

When creating blinded paths for receiving onion payments, allow using
the recipient's only peer as the introduction node when the recipient is
unannounced. This allows for sending payments without going through an
intermediary, which is useful for testing or when only connected to an
LSP with an empty NetworkGraph.

2 months agoBlindedPath with unannounced introduction node
Jeffrey Czyz [Wed, 12 Jun 2024 15:58:18 +0000 (10:58 -0500)]
BlindedPath with unannounced introduction node

When creating blinded paths for receiving onion messages, allow using
the recipient's only peer as the introduction node when the recipient is
unannounced. This allows for sending messages without going through an
intermediary, which is useful for testing or when only connected to an
LSP with an empty NetworkGraph.