]> git.bitcoin.ninja Git - rust-lightning/log
rust-lightning
4 months agoAdd pending changelog entry for the previous commit 2024-07-better-enum-upgradable-ser
Matt Corallo [Mon, 8 Jul 2024 20:43:51 +0000 (20:43 +0000)]
Add pending changelog entry for the previous commit

4 months agoMake `impl_writeable_tlv_based_enum*` actually upgradable
Matt Corallo [Mon, 8 Jul 2024 19:21:19 +0000 (19:21 +0000)]
Make `impl_writeable_tlv_based_enum*` actually upgradable

In cc78b77c715d6ef62693d4c1bc7190da990ec0fa it was discovered that
`impl_writeable_tlv_based_enum_upgradable` wasn't actually
upgradable - tuple variants weren't written with length-prefixes,
causing downgrades with new tuple variants to be unreadable by
older clients as they wouldn't know where to stop reading.

This was fixed by simply assuming that any new variants will be
non-tuple variants with a length prefix, but no code write-side
changes were made, allowing new code to freely continue to use the
broken tuple-variant serialization.

Here we address this be defining yet more serialization macros
which aren't broken, and convert existing usage of the existing
macros using non-length-prefixed tuple variants to renamed
`*_legacy` macros.

Note that this changes the serialization format of
`impl_writeable_tlv_based_enum[_upgradable]` when tuple fields are
written, and as such deliberately changes the call semantics for
such tuples.

Only the serialization format of `MessageContext` is changed here
which is fine as it has not yet reached a release of LDK.

4 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

4 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

4 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>
4 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

4 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.

4 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.

4 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

4 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

4 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.

4 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.

4 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`

4 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.

4 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.

4 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.

4 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.

4 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

4 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.

4 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.

4 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

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

4 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.

4 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.

4 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.

4 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

4 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

4 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

4 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`

4 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.

4 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.

4 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

4 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

4 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.

4 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

4 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

4 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

4 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

4 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

5 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.

5 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.

5 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

5 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

5 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.

5 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

5 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.

5 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.

5 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.

5 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.

5 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

5 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

5 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.

5 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`

5 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

5 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`

5 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`

5 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`

5 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.

5 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

5 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.

5 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`

5 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.

5 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

5 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.

5 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.

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

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

5 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.

5 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.

5 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.

5 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.

5 months agoMerge pull request #3130 from TheBlueMatt/2024-06-doc-fee-present
Elias Rohrer [Tue, 18 Jun 2024 12:49:38 +0000 (14:49 +0200)]
Merge pull request #3130 from TheBlueMatt/2024-06-doc-fee-present

Document when `Events::PaymentSent::pending_fee_msat` is `Some`

5 months agoRemove global availability logic for testing async signing
Alec Chen [Tue, 11 Jun 2024 00:18:52 +0000 (17:18 -0700)]
Remove global availability logic for testing async signing

5 months agoRefactor tests to use specific async signing ops
Alec Chen [Mon, 17 Jun 2024 21:28:21 +0000 (14:28 -0700)]
Refactor tests to use specific async signing ops

5 months agoAllow toggling specific signing methods in test channel signer
Alec Chen [Mon, 10 Jun 2024 22:01:11 +0000 (15:01 -0700)]
Allow toggling specific signing methods in test channel signer

5 months agoStart tracking chain_sync_monitor_persistences in TestPersister
G8XSU [Fri, 14 Jun 2024 23:55:39 +0000 (16:55 -0700)]
Start tracking chain_sync_monitor_persistences in TestPersister

It is helpful to assert that chain-sync did trigger a monitor
persist.

5 months agoMerge pull request #3128 from TheBlueMatt/2024-06-no-claim-ret
valentinewallace [Mon, 17 Jun 2024 14:13:04 +0000 (10:13 -0400)]
Merge pull request #3128 from TheBlueMatt/2024-06-no-claim-ret

Drop unused return value from `claim_funds_from_hop`

5 months agoDocument when `Events::PaymentSent::pending_fee_msat` is `Some` 2024-06-doc-fee-present
Matt Corallo [Mon, 17 Jun 2024 13:53:20 +0000 (13:53 +0000)]
Document when `Events::PaymentSent::pending_fee_msat` is `Some`

5 months agoMerge pull request #3123 from dunxen/2024-06-channelrefactor
Elias Rohrer [Mon, 17 Jun 2024 07:23:18 +0000 (09:23 +0200)]
Merge pull request #3123 from dunxen/2024-06-channelrefactor

Move accept_channel checks into `ChannelContext::do_accept_channel_checks`

5 months agoDrop unused return value from `claim_funds_from_hop` 2024-06-no-claim-ret
Matt Corallo [Sun, 16 Jun 2024 14:15:07 +0000 (14:15 +0000)]
Drop unused return value from `claim_funds_from_hop`

5 months agoMove accept_channel checks into `ChannelContext::do_accept_channel_checks`
Duncan Dean [Thu, 13 Jun 2024 12:12:47 +0000 (14:12 +0200)]
Move accept_channel checks into `ChannelContext::do_accept_channel_checks`

This is done ahead of getting the dual-funding implementation to reduce
refactoring noise there.

5 months agoser_macros: support messages with no fields
Valentine Wallace [Wed, 5 Jun 2024 17:06:11 +0000 (13:06 -0400)]
ser_macros: support messages with no fields

5 months agoMerge pull request #3102 from tnull/2024-06-rustfmt-fuzz
Matt Corallo [Thu, 13 Jun 2024 13:56:33 +0000 (06:56 -0700)]
Merge pull request #3102 from tnull/2024-06-rustfmt-fuzz

`rustfmt`: Reformat the `fuzz` dir

5 months agoMerge pull request #3098 from arik-so/arik/gossip-v2-parsing
Elias Rohrer [Thu, 13 Jun 2024 06:48:06 +0000 (08:48 +0200)]
Merge pull request #3098 from arik-so/arik/gossip-v2-parsing

Parse v2 gossip

5 months agoMerge pull request #3078 from jkczyz/2024-05-invoice-event
Elias Rohrer [Thu, 13 Jun 2024 06:25:59 +0000 (08:25 +0200)]
Merge pull request #3078 from jkczyz/2024-05-invoice-event

Asynchronous `Bolt12Invoice` payment

5 months agoUpdate documentation.
Arik Sosman [Tue, 11 Jun 2024 19:10:44 +0000 (12:10 -0700)]
Update documentation.

5 months agoParse v2 gossip.
Arik Sosman [Thu, 9 May 2024 16:42:14 +0000 (09:42 -0700)]
Parse v2 gossip.

5 months agoAdd pays_bolt12_invoice_asynchronously test
Jeffrey Czyz [Wed, 22 May 2024 16:28:31 +0000 (11:28 -0500)]
Add pays_bolt12_invoice_asynchronously test

5 months agoExpose send_payment_for_bolt12_invoice
Jeffrey Czyz [Tue, 21 May 2024 23:47:32 +0000 (18:47 -0500)]
Expose send_payment_for_bolt12_invoice

UserConfig::manually_handle_bolt12_invoices allows deferring payment of
BOLT12 invoices by generating Event::InvoiceReceived. Expose
ChannelManager::send_payment_for_bolt12_invoice to allow users to pay
the Bolt12Invoice included in the event. While the event contains the
PaymentId for reference, that parameter is now removed from the method
in favor of extracting the PaymentId from the invoice's payer_metadata.

5 months agoReformat and tick config docs
Jeffrey Czyz [Wed, 12 Jun 2024 16:51:23 +0000 (11:51 -0500)]
Reformat and tick config docs

5 months agoAdd UserConfig::manually_handle_bolt12_invoices
Jeffrey Czyz [Tue, 21 May 2024 21:58:10 +0000 (16:58 -0500)]
Add UserConfig::manually_handle_bolt12_invoices

BOLT12 invoices are automatically paid once they have been verified.
Users may want to manually pay them by first performing additional
checks. Add a manually_handle_bolt12_invoices configuration option that
when set generates an Event::InvoiceReceived instead of paying the
invoice.

5 months agoMerge pull request #3082 from valentinewallace/2024-04-bolt12-keysend-invoice
Matt Corallo [Wed, 12 Jun 2024 22:17:48 +0000 (15:17 -0700)]
Merge pull request #3082 from valentinewallace/2024-04-bolt12-keysend-invoice

BOLT 12 static invoice encoding and building

5 months agoMerge pull request #3103 from TheBlueMatt/2024-06-real-bench
Matt Corallo [Wed, 12 Jun 2024 22:17:25 +0000 (15:17 -0700)]
Merge pull request #3103 from TheBlueMatt/2024-06-real-bench

Use a real (probing-generated) scorer in benchmarks

5 months agoStatic invoice parsing tests
Valentine Wallace [Fri, 31 May 2024 20:17:38 +0000 (16:17 -0400)]
Static invoice parsing tests

5 months agoStatic invoice building tests
Valentine Wallace [Tue, 4 Jun 2024 23:12:54 +0000 (19:12 -0400)]
Static invoice building tests

5 months agoBuilder for creating static invoices from offers
Valentine Wallace [Thu, 9 May 2024 21:15:34 +0000 (17:15 -0400)]
Builder for creating static invoices from offers

Add a builder for creating static invoices for an offer. Building produces a
semantically valid static invoice for the offer, which can then be signed with
the key associated with the offer's signing pubkey.

5 months agoAdd an InvoiceReceived event
Jeffrey Czyz [Tue, 21 May 2024 19:33:56 +0000 (14:33 -0500)]
Add an InvoiceReceived event

Some users may want to handle a Bolt12Invoice asynchronously, either in
a different process or by first performing additional verification
before paying the invoice. Add an InvoiceReceived event to facilitate
this.

5 months ago`rustfmt`: `fuzz/src/full_stack.rs`
Elias Rohrer [Mon, 10 Jun 2024 08:48:19 +0000 (10:48 +0200)]
`rustfmt`: `fuzz/src/full_stack.rs`

5 months agoPrepare `fuzz/src/full_stack.rs` for `rustfmt`
Elias Rohrer [Mon, 10 Jun 2024 08:47:50 +0000 (10:47 +0200)]
Prepare `fuzz/src/full_stack.rs` for `rustfmt`

5 months ago`rustfmt`: `fuzz/src/chanmon_consistency.rs`
Elias Rohrer [Mon, 10 Jun 2024 08:37:50 +0000 (10:37 +0200)]
`rustfmt`: `fuzz/src/chanmon_consistency.rs`