]> git.bitcoin.ninja Git - rust-lightning/log
rust-lightning
2 months agoAdd an implementation of mutual message exchange 2024-01-mutual-message-exchange
Matt Corallo [Mon, 15 Jan 2024 04:20:55 +0000 (04:20 +0000)]
Add an implementation of mutual message exchange

This adds a new crate, `mutual-message-exchange` which allows two
parties to maintain a list of keys with which they want to exchange
messages and exchange one message at the cost of an extra
half-round-trip.

This is anticipated for use in BOLT12, where extra data can be
included in a BOLT12 `Invoice` which allows a mutually-trusting
sender to include a message in the onion, while any
non-mutually-trusting entities will not learn anything about the
recipient (subject to the use of blinded paths).

A full write-up of this protocol is available as
[bLIP 31](https://github.com/lightning/blips/pull/31).

2 months agoMake `ChaCha20::get_single_block` return a full, single block
Matt Corallo [Tue, 16 Jan 2024 19:53:39 +0000 (19:53 +0000)]
Make `ChaCha20::get_single_block` return a full, single block

While the current uses for `ChaCha20::get_single_block` only
actually want 32 bytes, a ChaCha20 block is 64 bytes, and future
uses may want another 32 bytes, so we can go ahead and return the
whole block when asked for one.

2 months agoDrop `lightning`-specific code in `lightning::crypto`
Matt Corallo [Wed, 2 Oct 2024 19:05:29 +0000 (19:05 +0000)]
Drop `lightning`-specific code in `lightning::crypto`

In a few commits, we'll reuse the `chacha20.rs` and `poly1305.rs`
files in a new crate (via symlink). In order to do so, we need to
first avoid any references to things in the `lightning` crate,
which we do here by dropping references to `crate::prelude`.

2 months agoMerge pull request #3179 from TheBlueMatt/2024-07-human-readable-names-resolution-1
Arik [Wed, 2 Oct 2024 17:00:13 +0000 (10:00 -0700)]
Merge pull request #3179 from TheBlueMatt/2024-07-human-readable-names-resolution-1

Add the core functionality required to resolve Human Readable Names

2 months agoMerge pull request #3301 from dunxen/2024-9-fixnevertypefallback
Matt Corallo [Wed, 2 Oct 2024 14:29:09 +0000 (14:29 +0000)]
Merge pull request #3301 from dunxen/2024-9-fixnevertypefallback

Add an explicit_type TLV syntax for avoiding certain cases of type inference

2 months agoAdd an `explicit_type` TLV syntax for avoiding certain cases of type inference
Duncan Dean [Fri, 6 Sep 2024 10:26:19 +0000 (12:26 +0200)]
Add an `explicit_type` TLV syntax for avoiding certain cases of type inference

This new syntax is used to fix "dependency on fallback of ! -> ()".
This avoids cases where code compiles with a fallback of the
never type leading to the unit type. The behaviour in Rust edition 2024
would make this a compile error.

See: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint/builtin/static.DEPENDENCY_ON_UNIT_NEVER_TYPE_FALLBACK.html#

2 months agoMerge pull request #3324 from tnull/2024-09-rustfmt-util-1
Matt Corallo [Tue, 1 Oct 2024 15:33:17 +0000 (15:33 +0000)]
Merge pull request #3324 from tnull/2024-09-rustfmt-util-1

`rustfmt`: Run on `util/*` (1/2)

2 months agoMerge pull request #3311 from TheBlueMatt/2024-09-3010-followups
Matt Corallo [Mon, 30 Sep 2024 21:21:20 +0000 (21:21 +0000)]
Merge pull request #3311 from TheBlueMatt/2024-09-3010-followups

Quick #3010 followups

2 months agoCall `ChannelMessageHandler::message_received` without peer lock 2024-09-3010-followups
Matt Corallo [Thu, 12 Sep 2024 15:17:15 +0000 (15:17 +0000)]
Call `ChannelMessageHandler::message_received` without peer lock

While `message_received` purports to be called on every message,
prior to the message, doing so on `Init` messages means we have to
call `message_received` while holding the per-peer mutex, which
can cause some lock contention.

Instead, here, we call `message_received` after processing `Init`
messages (which is probably more useful anyway - the peer isn't
really "connected" until we've processed the `Init` messages),
allowing us to call it unlocked.

2 months agoCheck that we aren't reading a second message in BOLT 12 retry test
Matt Corallo [Thu, 12 Sep 2024 15:13:11 +0000 (15:13 +0000)]
Check that we aren't reading a second message in BOLT 12 retry test

`creates_and_pays_for_offer_with_retry` intends to check that we
re-send a BOLT 12 `invoice_request` in response to a
`message_received` call, but doesn't actually test that there were
no messages in the outbound buffer after the initial send, which we
do here.

2 months agoAdd the core functionality required to resolve Human Readable Names 2024-07-human-readable-names-resolution-1
Matt Corallo [Thu, 12 Sep 2024 15:57:42 +0000 (15:57 +0000)]
Add the core functionality required to resolve Human Readable Names

This adds a new utility struct, `OMNameResolver`, which implements
the core functionality required to resolve Human Readable Names,
namely generating `DNSSECQuery` onion messages, tracking the state
of requests, and ultimately receiving and verifying `DNSSECProof`
onion messages.

It tracks pending requests with a `PaymentId`, allowing for easy
integration into `ChannelManager` in a coming commit - mapping
received proofs to `PaymentId`s which we can then complete by
handing them `Offer`s to pay.

It does not, directly, implement `DNSResolverMessageHandler`, but
an implementation of `DNSResolverMessageHandler` becomes trivial
with `OMNameResolver` handling the inbound messages and creating
the messages to send.

2 months agoAllow `_` in `Hostname`s
Matt Corallo [Mon, 30 Sep 2024 18:03:12 +0000 (18:03 +0000)]
Allow `_` in `Hostname`s

These are perfectly fine and are relied on by BIP 353, so we need
to ensure we allow them.

2 months agoAdd a type to track `HumanReadableName`s
Matt Corallo [Sat, 13 Jul 2024 16:23:47 +0000 (16:23 +0000)]
Add a type to track `HumanReadableName`s

BIP 353 `HumanReadableName`s are represented as `â‚¿user@domain` and
can be resolved using DNS into a `bitcoin:` URI. In the next
commit, we will add such a resolver using onion messages to fetch
records from the DNS, which will rely on this new type to get name
information from outside LDK.

2 months agoParse and handle `DNSResolverMessage`s in `OnionMessenger`
Matt Corallo [Sat, 13 Jul 2024 17:08:27 +0000 (17:08 +0000)]
Parse and handle `DNSResolverMessage`s in `OnionMessenger`

This adds the requisite message parsing and handling code for the
new DNSSEC messages to `OnionMessenger`.

2 months agoAdd DNS(SEC) query and proof messages and onion message handler
Matt Corallo [Mon, 30 Sep 2024 16:16:36 +0000 (16:16 +0000)]
Add DNS(SEC) query and proof messages and onion message handler

This creates the initial DNSSEC proof and query messages in a new
module in `onion_message`, as well as a new message handler to
handle them.

In the coming commits, a default implementation will be added which
verifies DNSSEC proofs which can be used to resolve BIP 353 URIs
without relying on anything outside of the lightning network.

2 months agoAdd a `MessageContext::DNSResolution` to protect against probing
Matt Corallo [Mon, 30 Sep 2024 14:45:36 +0000 (14:45 +0000)]
Add a `MessageContext::DNSResolution` to protect against probing

When we make a DNSSEC query with a reply path, we don't want to
allow the DNS resolver to attempt to respond to various nodes to
try to detect (through timining or other analysis) whether we were
the one who made the query. Thus, we need to include a nonce in the
context in our reply path, which we set up here by creating a new
context type for DNS resolutions.

2 months agoMerge pull request #3341 from TheBlueMatt/2024-09-gossip-rustfmt-cleanup
Matt Corallo [Fri, 27 Sep 2024 00:53:08 +0000 (00:53 +0000)]
Merge pull request #3341 from TheBlueMatt/2024-09-gossip-rustfmt-cleanup

Minor `gossip.rs` `rustfmt` cleanups

2 months agoMinor `gossip.rs` `rustfmt` cleanups 2024-09-gossip-rustfmt-cleanup
Matt Corallo [Thu, 26 Sep 2024 06:05:22 +0000 (06:05 +0000)]
Minor `gossip.rs` `rustfmt` cleanups

Just a few minor updates to `gossip.rs` to reduce code verticality
and simplify things a bit.

2 months agoMerge pull request #3336 from tnull/2024-09-rustfmt-router
valentinewallace [Wed, 25 Sep 2024 04:20:36 +0000 (13:20 +0900)]
Merge pull request #3336 from tnull/2024-09-rustfmt-router

`rustfmt`: Run on the `routing` directory (1/3)

2 months agoMerge pull request #3334 from arik-so/lint_fixes
Elias Rohrer [Wed, 25 Sep 2024 02:16:08 +0000 (11:16 +0900)]
Merge pull request #3334 from arik-so/lint_fixes

Fix linter complaints

2 months ago`rustfmt`: Drop `routing/gossip.rs` from exclusion list
Elias Rohrer [Tue, 24 Sep 2024 04:51:52 +0000 (13:51 +0900)]
`rustfmt`: Drop `routing/gossip.rs` from exclusion list

2 months ago`rustfmt`: Run on `routing/gossip.rs`
Elias Rohrer [Tue, 24 Sep 2024 04:51:52 +0000 (13:51 +0900)]
`rustfmt`: Run on `routing/gossip.rs`

2 months agoSuppress linter warnings
Arik Sosman [Tue, 24 Sep 2024 04:38:31 +0000 (13:38 +0900)]
Suppress linter warnings

Allow `map_err` and `dependency_on_unit_never_type_fallback` pending
a future MSRV increase.

2 months agoMerge pull request #3303 from TheBlueMatt/2024-09-inbound-payment-id
Elias Rohrer [Tue, 24 Sep 2024 04:38:16 +0000 (13:38 +0900)]
Merge pull request #3303 from TheBlueMatt/2024-09-inbound-payment-id

Add a `PaymentId` for inbound payments

2 months agoMerge pull request #3310 from TheBlueMatt/2024-09-unlocked-checksig
Matt Corallo [Tue, 24 Sep 2024 03:13:51 +0000 (03:13 +0000)]
Merge pull request #3310 from TheBlueMatt/2024-09-unlocked-checksig

Validate `channel_update` signatures without holding a graph lock

2 months agoMerge pull request #3326 from jkczyz/2024-09-split-router
Elias Rohrer [Tue, 24 Sep 2024 02:47:45 +0000 (11:47 +0900)]
Merge pull request #3326 from jkczyz/2024-09-split-router

Decouple `MessageRouter` from `Router`

2 months agoValidate `channel_update` signatures without holding a graph lock 2024-09-unlocked-checksig
Matt Corallo [Wed, 11 Sep 2024 23:36:29 +0000 (23:36 +0000)]
Validate `channel_update` signatures without holding a graph lock

We often process many gossip messages in parallel across different
peer connections, making the `NetworkGraph` mutexes fairly
contention-sensitive (not to mention the potential that we want to
send a payment and need to find a path to do so).

Because we need to look up a node's public key to validate a
signature on `channel_update` messages, we always need to take a
`NetworkGraph::channels` lock before we can validate the message.

For simplicity, and to avoid taking a lock twice, we'd always
validated the `channel_update` signature while holding the same
lock, but here we address the contention issues by doing a
`channel_update` validation in three stages.

First we take a read lock on `NetworkGraph::channels` and check if
the `channel_update` is new, then release the lock and validate the
message signature, and finally take a write lock, (re-check if the
`channel_update` is new) and update the graph.

2 months agoDe-couple MessageRouter from Router
Jeffrey Czyz [Wed, 18 Sep 2024 17:40:48 +0000 (12:40 -0500)]
De-couple MessageRouter from Router

Now that ChannelManager is parameterized by both a MessageRouter and a
Router, Router implementations no longer need to implement
MessageRouter, too.

2 months agoExpand DefaultRouter's privacy docs
Jeffrey Czyz [Wed, 18 Sep 2024 17:06:26 +0000 (12:06 -0500)]
Expand DefaultRouter's privacy docs

DefaultRouter::create_blinded_payment_paths may creat a one-hop blinded
path with the recipient as the introduction node. Update the privacy
section of DefaultRouter's docs to indicate this as is done in the docs
for DefaultMessageRouter.

2 months agoParameterize ChannelManager with MessageRouter
Jeffrey Czyz [Wed, 18 Sep 2024 16:52:38 +0000 (11:52 -0500)]
Parameterize ChannelManager with MessageRouter

ChannelManager is parameterized by a Router, which must also implement
MessageRouter. Instead, add a MessageRouter parameter such that the
Router and MessageRouter traits can be de-coupled. This simplifies using
something other than DefaultMessageRouter, which DefaultRouter currently
delegates to.

2 months agoAdd a `PaymentId` for inbound payments 2024-09-inbound-payment-id
Matt Corallo [Thu, 12 Sep 2024 18:36:58 +0000 (18:36 +0000)]
Add a `PaymentId` for inbound payments

We expect our users to have fully idempotent `Event` handling as we
may replay events on restart for one of a number of reasons. This
isn't a big deal as long as all our events have some kind of
identifier users can use to check if the `Event` has already been
handled.

For outbound payments, this is the `PaymentId` they provide in the
send methods, however for inbound payments we don't have a great
option.

`PaymentHash` largely suffices - users can simply always claim in
response to a `PaymentClaimable` of sufficient value and treat a
`PaymentClaimed` event as duplicate any time they see a second one
for the same `PaymentHash`. This mostly works, but may result in
accepting duplicative payments if someone (incorrectly) pays twice
for the same `PaymentHash`.

Users could also fail for duplicative `PaymentClaimable` events of
the same `PaymentHash`, but doing so may result in spuriously
failing a payment if the `PaymentClaimable` event is a replay and
they never saw a corresponding `PaymentClaimed` event.

While none of this will result in spuriously thinking they've been
paid when they have not, it does result in some pretty awkward
semantics which we'd rather avoid our users having to deal with.

Instead, here, we add a new `PaymentId` which is simply an HMAC of
the HTLCs (as Channel ID, HTLC ID pairs) which were included in the
payment.

2 months agoAdd an `inbound_payment_id_secret` to `ChannelManager`
Matt Corallo [Sun, 8 Sep 2024 16:38:22 +0000 (16:38 +0000)]
Add an `inbound_payment_id_secret` to `ChannelManager`

In the next commit we'll start generating `PaymentId`s for inbound
payments randomly by HMAC'ing the HTLC set of the payment. Here we
start by defining the HMAC secret for these HMACs.

This requires one small test adaptation and a full_stack_target
fuzz change because it changes the RNG consumption.

2 months agoDo not check the ordering of HTLCs in `PaymentClaim[able,ed]`
Matt Corallo [Sun, 8 Sep 2024 16:09:12 +0000 (16:09 +0000)]
Do not check the ordering of HTLCs in `PaymentClaim[able,ed]`

In the next commit we'll change the order of HTLCs in
`PaymentClaim[able,ed]` events. This shouldn't break anything, but
our current functional tests check that the HTLCs are provided in
the order they expect (the order they were received). Instead, here
we only validate that each claimed HTLC matches one expected path.

2 months ago`rustfmt`: Drop `util/persist.rs` from exclusion list
Elias Rohrer [Wed, 18 Sep 2024 07:40:36 +0000 (09:40 +0200)]
`rustfmt`: Drop `util/persist.rs` from exclusion list

2 months ago`rustfmt`: Run on `util/persist.rs`
Elias Rohrer [Wed, 18 Sep 2024 07:40:36 +0000 (09:40 +0200)]
`rustfmt`: Run on `util/persist.rs`

2 months ago`rustfmt`: Prepare `util/persist.rs`
Elias Rohrer [Thu, 19 Sep 2024 07:58:02 +0000 (09:58 +0200)]
`rustfmt`: Prepare `util/persist.rs`

2 months ago`rustfmt`: Run on `util/message_signing.rs`
Elias Rohrer [Wed, 18 Sep 2024 07:40:27 +0000 (09:40 +0200)]
`rustfmt`: Run on `util/message_signing.rs`

2 months ago`rustfmt`: Drop `util/macro_logger.rs` from exclusion list
Elias Rohrer [Wed, 18 Sep 2024 07:40:21 +0000 (09:40 +0200)]
`rustfmt`: Drop `util/macro_logger.rs` from exclusion list

2 months ago`rustfmt`: Run on `util/macro_logger.rs`
Elias Rohrer [Wed, 18 Sep 2024 07:40:21 +0000 (09:40 +0200)]
`rustfmt`: Run on `util/macro_logger.rs`

2 months ago`rustfmt`: Drop `util/logger.rs` from exclusion list
Elias Rohrer [Wed, 18 Sep 2024 07:40:16 +0000 (09:40 +0200)]
`rustfmt`: Drop `util/logger.rs` from exclusion list

2 months ago`rustfmt`: Run on `util/logger.rs`
Elias Rohrer [Wed, 18 Sep 2024 07:40:16 +0000 (09:40 +0200)]
`rustfmt`: Run on `util/logger.rs`

2 months ago`rustfmt`: Drop `util/indexed_map.rs` from exclusion list
Elias Rohrer [Wed, 18 Sep 2024 07:40:09 +0000 (09:40 +0200)]
`rustfmt`: Drop `util/indexed_map.rs` from exclusion list

2 months ago`rustfmt`: Run on `util/indexed_map.rs`
Elias Rohrer [Wed, 18 Sep 2024 07:40:09 +0000 (09:40 +0200)]
`rustfmt`: Run on `util/indexed_map.rs`

2 months ago`rustfmt`: Drop `util/fuzz_wrappers.rs` from exclusion list
Elias Rohrer [Wed, 18 Sep 2024 07:39:50 +0000 (09:39 +0200)]
`rustfmt`: Drop `util/fuzz_wrappers.rs` from exclusion list

2 months ago`rustfmt`: Run on `util/fuzz_wrappers.rs`
Elias Rohrer [Wed, 18 Sep 2024 07:39:50 +0000 (09:39 +0200)]
`rustfmt`: Run on `util/fuzz_wrappers.rs`

2 months ago`rustfmt`: Drop `util/errors.rs` from exclusion list
Elias Rohrer [Wed, 18 Sep 2024 07:39:43 +0000 (09:39 +0200)]
`rustfmt`: Drop `util/errors.rs` from exclusion list

2 months ago`rustfmt`: Run on `util/errors.rs`
Elias Rohrer [Wed, 18 Sep 2024 07:39:43 +0000 (09:39 +0200)]
`rustfmt`: Run on `util/errors.rs`

2 months ago`rustfmt`: Drop `util/config.rs` from exclusion list
Elias Rohrer [Wed, 18 Sep 2024 07:39:39 +0000 (09:39 +0200)]
`rustfmt`: Drop `util/config.rs` from exclusion list

2 months ago`rustfmt`: Run on `util/config.rs`
Elias Rohrer [Wed, 18 Sep 2024 07:39:38 +0000 (09:39 +0200)]
`rustfmt`: Run on `util/config.rs`

2 months ago`rustfmt`: Drop `util/byte_utils.rs` from exclusion list
Elias Rohrer [Wed, 18 Sep 2024 07:39:30 +0000 (09:39 +0200)]
`rustfmt`: Drop `util/byte_utils.rs` from exclusion list

2 months ago`rustfmt`: Run on `util/byte_utils.rs`
Elias Rohrer [Wed, 18 Sep 2024 07:39:30 +0000 (09:39 +0200)]
`rustfmt`: Run on `util/byte_utils.rs`

2 months ago`rustfmt`: Drop `util/base32.rs` from exclusion list
Elias Rohrer [Wed, 18 Sep 2024 07:39:24 +0000 (09:39 +0200)]
`rustfmt`: Drop `util/base32.rs` from exclusion list

2 months ago`rustfmt`: Run on `util/base32.rs`
Elias Rohrer [Wed, 18 Sep 2024 07:39:24 +0000 (09:39 +0200)]
`rustfmt`: Run on `util/base32.rs`

2 months ago`rustfmt`: Drop `util/atomic_counter.rs` from exclusion list
Elias Rohrer [Wed, 18 Sep 2024 07:39:18 +0000 (09:39 +0200)]
`rustfmt`: Drop `util/atomic_counter.rs` from exclusion list

2 months ago`rustfmt`: Run on `util/atomic_counter.rs`
Elias Rohrer [Wed, 18 Sep 2024 07:39:18 +0000 (09:39 +0200)]
`rustfmt`: Run on `util/atomic_counter.rs`

2 months agoMerge pull request #3327 from TheBlueMatt/2024-09-local-ci-rustfmt
Elias Rohrer [Thu, 19 Sep 2024 07:30:23 +0000 (09:30 +0200)]
Merge pull request #3327 from TheBlueMatt/2024-09-local-ci-rustfmt

Only attempt to `rustfmt` files checked into git

2 months agoOnly attempt to `rustfmt` files checked into git 2024-09-local-ci-rustfmt
Matt Corallo [Wed, 18 Sep 2024 18:03:11 +0000 (18:03 +0000)]
Only attempt to `rustfmt` files checked into git

This avoids `rustfmt` failing on Rust files generated by dependent
crates in `target`, eg

```
+ rustfmt --edition 2021 --check ./target/debug/build/thiserror-8230374e07b5c05a/out/probe.rs
Diff in /home/matt/rust-lightning-3/target/debug/build/thiserror-8230374e07b5c05a/out/probe.rs at line 1:

-    #![feature(provide_any)]
+#![feature(provide_any)]

-    use std::any::{Demand, Provider};
+use std::any::{Demand, Provider};

-    fn _f<'a, P: Provider>(p: &'a P, demand: &mut Demand<'a>) {
-        p.provide(demand);
-    }
+fn _f<'a, P: Provider>(p: &'a P, demand: &mut Demand<'a>) {
+ p.provide(demand);
+}
```

2 months agoRe-order imports
Jeffrey Czyz [Wed, 18 Sep 2024 16:08:29 +0000 (11:08 -0500)]
Re-order imports

2 months agoMerge pull request #3289 from tnull/2024-09-fix-rgs-bp-builds
Matt Corallo [Wed, 18 Sep 2024 14:31:18 +0000 (14:31 +0000)]
Merge pull request #3289 from tnull/2024-09-fix-rgs-bp-builds

Fix builds of `lightning-rapid-gossip-sync` and `lightning-background-processor` crates

2 months agoDrop `no-std` feature
Elias Rohrer [Fri, 13 Sep 2024 11:14:40 +0000 (13:14 +0200)]
Drop `no-std` feature

We drop the `lightning/no-std` feature and just take
`hashbrown`,`possiblyrandom` and `libm` as required dependencies.

2 months agoCheck workspace members with default features individually in CI
Elias Rohrer [Wed, 4 Sep 2024 09:10:13 +0000 (11:10 +0200)]
Check workspace members with default features individually in CI

Previously, we would only check the workspace as a whole. This however
would mean that we would check/test crates with `lightning`'s default
features enabled, allowing failures-to-build under the crates own
default features to slip through, if they didn't explicitly enable
`lightning/std`, for example.

Here, we extend the CI to check the workspace as a whole but then run
checks, tests, and doc generation on the workspace members individually,
asserting that all of them build even when not built as part of the same
workspace as `lightning`.

2 months agoRe-add optional `std` feature dependencies to fix RGS and BP builds
Elias Rohrer [Wed, 4 Sep 2024 08:53:37 +0000 (10:53 +0200)]
Re-add optional `std` feature dependencies to fix RGS and BP builds

We previously removed these, leading to failure to build under default
features including `std`.

2 months agoMerge pull request #3321 from valentinewallace/2024-09-fix-main
Matt Corallo [Tue, 17 Sep 2024 21:45:30 +0000 (21:45 +0000)]
Merge pull request #3321 from valentinewallace/2024-09-fix-main

Fix silent rebase conflict that broke tests

2 months agoFix silent rebase conflict that broke tests
Valentine Wallace [Tue, 17 Sep 2024 21:24:39 +0000 (17:24 -0400)]
Fix silent rebase conflict that broke tests

429cbe1a060a5ee7abb421c65d2cf5e503909215 merged a PR that renamed
Offer::signing_pubkey to Offer::issuer_signing_pubkey. However, there was a
silent rebase conflict and a test added as part of
1059f5ffc55d3c21bf4d3ae82fe185f588a53116 did not get the memo and used the old
method name, breaking the test build.

2 months agoMerge pull request #3319 from tnull/2024-09-rustfmt-sync
Matt Corallo [Tue, 17 Sep 2024 19:37:51 +0000 (19:37 +0000)]
Merge pull request #3319 from tnull/2024-09-rustfmt-sync

`rustfmt`: Run on `lightning/src/sync/*`

2 months agoMerge pull request #3313 from valentinewallace/2024-09-fix-offer-double-pay
Matt Corallo [Tue, 17 Sep 2024 17:38:04 +0000 (17:38 +0000)]
Merge pull request #3313 from valentinewallace/2024-09-fix-offer-double-pay

Don't pay a duplicate BOLT 12 invoice if `ChannelManager` is stale

2 months agoMerge pull request #3218 from jkczyz/2024-07-offers-spec-update
Matt Corallo [Tue, 17 Sep 2024 14:01:43 +0000 (14:01 +0000)]
Merge pull request #3218 from jkczyz/2024-07-offers-spec-update

Rename `Offer::signing_pubkey` to `Offer::issuer_id`

2 months agoFix bug where we double-pay an offer due to stale manager
Valentine Wallace [Mon, 16 Sep 2024 16:26:16 +0000 (12:26 -0400)]
Fix bug where we double-pay an offer due to stale manager

This fixes the following bug:
- An outbound payment is AwaitingInvoice
- We receive an invoice and lock the HTLCs into the relevant ChannelMonitors
- The monitors are successfully persisted, but the ChannelManager fails to
  persist, so the outbound payment remains AwaitingInvoice
- We restart, causing the channels to close due to a stale ChannelManager
- We receive a duplicate invoice, and attempt to pay it again due to the
  payment still being AwaitingInvoice in the stale ChannelManager

After the fix for this, we will notice that the payment is already locked into
the monitor on startup and transition the incorrectly-AwaitingInvoice payment
to Retryable, which prevents double-paying on duplicate invoice receipt.

2 months ago`rustfmt`: Drop `sync/mod.rs` from exclusion list
Elias Rohrer [Tue, 17 Sep 2024 11:07:52 +0000 (13:07 +0200)]
`rustfmt`: Drop `sync/mod.rs` from exclusion list

2 months ago`rustfmt`: Run on `sync/mod.rs`
Elias Rohrer [Tue, 17 Sep 2024 11:07:28 +0000 (13:07 +0200)]
`rustfmt`: Run on `sync/mod.rs`

2 months ago`rustfmt`: Drop `sync/test_lockorder_checks.rs` from exclusion list
Elias Rohrer [Tue, 17 Sep 2024 11:06:51 +0000 (13:06 +0200)]
`rustfmt`: Drop `sync/test_lockorder_checks.rs` from exclusion list

2 months ago`rustfmt`: Run on `sync/test_lockorder_checks.rs`
Elias Rohrer [Tue, 17 Sep 2024 11:06:29 +0000 (13:06 +0200)]
`rustfmt`: Run on `sync/test_lockorder_checks.rs`

2 months ago`rustfmt`: Drop `sync/nostd_sync.rs` from exclusion list
Elias Rohrer [Tue, 17 Sep 2024 11:06:00 +0000 (13:06 +0200)]
`rustfmt`: Drop `sync/nostd_sync.rs` from exclusion list

2 months ago`rustfmt`: Run on `sync/nostd_sync.rs`
Elias Rohrer [Tue, 17 Sep 2024 11:05:40 +0000 (13:05 +0200)]
`rustfmt`: Run on `sync/nostd_sync.rs`

2 months ago`rustfmt`: Drop `sync/fairrwlock.rs` from exclusion list
Elias Rohrer [Tue, 17 Sep 2024 11:04:55 +0000 (13:04 +0200)]
`rustfmt`: Drop `sync/fairrwlock.rs` from exclusion list

2 months ago`rustfmt`: Run on `sync/fairrwlock.rs`
Elias Rohrer [Tue, 17 Sep 2024 11:04:35 +0000 (13:04 +0200)]
`rustfmt`: Run on `sync/fairrwlock.rs`

2 months ago`rustfmt`: Drop `sync/debug_sync.rs` from exclusion list
Elias Rohrer [Tue, 17 Sep 2024 11:03:59 +0000 (13:03 +0200)]
`rustfmt`: Drop `sync/debug_sync.rs` from exclusion list

2 months ago`rustfmt`: Run on `sync/debug_sync.rs`
Elias Rohrer [Tue, 17 Sep 2024 11:03:25 +0000 (13:03 +0200)]
`rustfmt`: Run on `sync/debug_sync.rs`

2 months agoRename Refund::payer_id
Jeffrey Czyz [Wed, 14 Aug 2024 20:36:18 +0000 (15:36 -0500)]
Rename Refund::payer_id

For consistency with Offer::issuer_signing_pubkey, rename
Refund::payer_id to use "signing_pubkey" instead of "id".

2 months agoRename InvoiceRequest::payer_id
Jeffrey Czyz [Wed, 14 Aug 2024 20:33:28 +0000 (15:33 -0500)]
Rename InvoiceRequest::payer_id

For consistency with Offer::issuer_signing_pubkey, rename
InvoiceRequest::payer_id to use "signing_pubkey" instead of "id".

2 months agoUpdate offer test vectors from latest spec changes
Jeffrey Czyz [Thu, 1 Aug 2024 22:46:53 +0000 (17:46 -0500)]
Update offer test vectors from latest spec changes

2 months agoUse unsigned invoice types in docs
Jeffrey Czyz [Thu, 8 Aug 2024 17:36:48 +0000 (12:36 -0500)]
Use unsigned invoice types in docs

2 months agoAdd issuer_signing_pubkey to Bolt12Invoice
Jeffrey Czyz [Thu, 1 Aug 2024 22:25:44 +0000 (17:25 -0500)]
Add issuer_signing_pubkey to Bolt12Invoice

Useful for determining if the signing_pubkey is the
issuer_signing_pubkey or is from a blinded path.

2 months agoRe-write Offer::issuer_signing_pubkey documentation
Jeffrey Czyz [Thu, 1 Aug 2024 22:25:14 +0000 (17:25 -0500)]
Re-write Offer::issuer_signing_pubkey documentation

2 months agoRename Offer::signing_pubkey to Offer::issuer_signing_pubkey
Jeffrey Czyz [Thu, 1 Aug 2024 15:56:51 +0000 (10:56 -0500)]
Rename Offer::signing_pubkey to Offer::issuer_signing_pubkey

The spec was recently changed to use offer_issuer_id instead of
offer_node_id. LDK always used signing_pubkey to avoid confusion with a
node_id. Rename it to issuer_signing_pubkey now as InvoiceRequest and
Bolt12Invoice will have similarly named methods in upcoming commits.

2 months agoMove monitor<>outbound_payments startup htlc syncing code.
Valentine Wallace [Mon, 16 Sep 2024 16:11:59 +0000 (12:11 -0400)]
Move monitor<>outbound_payments startup htlc syncing code.

Move the code that ensures that HTLCs locked into ChannelMonitors are
synchronized with the ChannelManager's OutboundPayments store to the
outbound_payments module.

This is useful both because ChannelManager::read is very long/confusing method,
so it's nice to encapsulate some of its functionality, and because we need to
fix an existing bug in this logic where we may risk double-paying an offer due
to outbound_payments being stale on startup. See the next commit for this
bugfix.

2 months agoTest utils: use full import path in reload_node macro.
Valentine Wallace [Thu, 12 Sep 2024 17:18:03 +0000 (13:18 -0400)]
Test utils: use full import path in reload_node macro.

2 months agoMerge pull request #3315 from tnull/2024-09-rustfmt-crypto
Matt Corallo [Mon, 16 Sep 2024 15:02:46 +0000 (15:02 +0000)]
Merge pull request #3315 from tnull/2024-09-rustfmt-crypto

`rustfmt`: Run on `crypto` module

2 months ago`rustfmt`: Drop `crypto/mod.rs` from exclusion list
Elias Rohrer [Mon, 16 Sep 2024 10:29:54 +0000 (12:29 +0200)]
`rustfmt`: Drop `crypto/mod.rs` from exclusion list

2 months ago`rustfmt`: Run on `crypto/mod.rs`
Elias Rohrer [Mon, 16 Sep 2024 10:29:35 +0000 (12:29 +0200)]
`rustfmt`: Run on `crypto/mod.rs`

2 months ago`rustfmt`: Drop `crypto/utils.rs` from exclusion list
Elias Rohrer [Mon, 16 Sep 2024 10:29:15 +0000 (12:29 +0200)]
`rustfmt`: Drop `crypto/utils.rs` from exclusion list

2 months ago`rustfmt`: Run on `crypto/utils.rs`
Elias Rohrer [Mon, 16 Sep 2024 10:28:41 +0000 (12:28 +0200)]
`rustfmt`: Run on `crypto/utils.rs`

2 months ago`rustfmt`: Drop `crypto/streams.rs` from exclusion list
Elias Rohrer [Mon, 16 Sep 2024 10:28:09 +0000 (12:28 +0200)]
`rustfmt`: Drop `crypto/streams.rs` from exclusion list

2 months ago`rustfmt`: Run on `crypto/streams.rs`
Elias Rohrer [Mon, 16 Sep 2024 10:27:34 +0000 (12:27 +0200)]
`rustfmt`: Run on `crypto/streams.rs`

2 months ago`rustfmt`: Drop `crypto/poly1305.rs` from exclusion list
Elias Rohrer [Mon, 16 Sep 2024 10:27:00 +0000 (12:27 +0200)]
`rustfmt`: Drop `crypto/poly1305.rs` from exclusion list

2 months ago`rustfmt`: Run on `crypto/poly1305.rs`
Elias Rohrer [Mon, 16 Sep 2024 10:26:29 +0000 (12:26 +0200)]
`rustfmt`: Run on `crypto/poly1305.rs`

2 months ago`rustfmt`: Drop `crypto/chacha20poly1305.rs` from exclusion list
Elias Rohrer [Mon, 16 Sep 2024 10:24:26 +0000 (12:24 +0200)]
`rustfmt`: Drop `crypto/chacha20poly1305.rs` from exclusion list

2 months ago`rustfmt`: Run on `crypto/chacha20poly1305rfc.rs`
Elias Rohrer [Mon, 16 Sep 2024 10:24:00 +0000 (12:24 +0200)]
`rustfmt`: Run on `crypto/chacha20poly1305rfc.rs`

2 months ago`rustfmt`: Drop `crypto/chacha20.rs` from exclusion list
Elias Rohrer [Mon, 16 Sep 2024 10:23:09 +0000 (12:23 +0200)]
`rustfmt`: Drop `crypto/chacha20.rs` from exclusion list

2 months ago`rustfmt`: Run on `crypto/chacha20.rs`
Elias Rohrer [Mon, 16 Sep 2024 10:22:48 +0000 (12:22 +0200)]
`rustfmt`: Run on `crypto/chacha20.rs`