Commit graph

8454 commits

Author SHA1 Message Date
Alec Chen
6368dfbbb8 Add cltv expiry to PendingHTLCRouting::Forward
In a coming commit we'll expire HTLCs backwards even if we haven't
yet claimed them on-chain based on their inbound edge being close
to causing a channel force-closure.

Here we track the incoming edge's CLTV expiry in the
pending-routing state so that we can include it in the `HTLCSource`
in the next commit.

Co-authored-by: Matt Corallo <git@bluematt.me>
2025-01-21 22:06:01 +00:00
valentinewallace
3d2b4de339
Merge pull request #3552 from TheBlueMatt/2025-01-3323-followups
`utils` cleanups
2025-01-21 13:14:12 -05:00
Matt Corallo
bc7631fe39 Clean up some spurious test_utils/transaction_utils variables
PR #3323 introduced some extra variables to avoid `rustfmt` making
a total mess of our code, but introduced a few that don't make
`rustfmt` do dumb things, which we remove here.
2025-01-20 19:24:58 +00:00
Matt Corallo
8e9ad555ab Import types we use in test_utils
`test_utils` is ancient and didn't import common types like
`ChannelMonitor` for some reason. Here we do that, cleaning up
some code.
2025-01-20 19:24:34 +00:00
Matt Corallo
86308e19e0
Merge pull request #3323 from tnull/2024-09-rustfmt-util
`rustfmt`: Run on `util/*` (2/2)
2025-01-20 19:10:45 +00:00
Elias Rohrer
5d6eaec9ff
rustfmt: Drop remaining util files from exclusion list 2025-01-20 10:54:55 +01:00
Elias Rohrer
ce50c41791
rustfmt: Drop util/mod.rs from exclusion list 2025-01-20 10:54:55 +01:00
Elias Rohrer
50356381c5
rustfmt: Run on util/mod.rs 2025-01-20 10:54:55 +01:00
Elias Rohrer
e2aca6ba74
rustfmt: Drop util/wakers.rs from exclusion list 2025-01-20 10:54:55 +01:00
Elias Rohrer
c349d7997e
rustfmt: Run on util/wakers.rs 2025-01-20 10:54:54 +01:00
Elias Rohrer
8e8c925577
rustfmt: Drop util/transaction_utils.rs from exclusion list 2025-01-20 10:54:54 +01:00
Elias Rohrer
b9fc8ba9aa
rustfmt: Run on util/transaction_utils.rs 2025-01-20 10:54:54 +01:00
Elias Rohrer
2be14b3ef5
rustfmt: Prepare util/transaction_utils.rs 2025-01-20 10:54:54 +01:00
Elias Rohrer
f2bc902507
rustfmt: Drop util/time.rs from exclusion list 2025-01-20 10:54:54 +01:00
Elias Rohrer
5a2731640d
rustfmt: Run on util/time.rs 2025-01-20 10:54:54 +01:00
Elias Rohrer
767646cdad
rustfmt: Drop util/test_utils.rs from exclusion list 2025-01-20 10:54:54 +01:00
Elias Rohrer
12fc953b27
rustfmt: Run on util/test_utils.rs 2025-01-20 10:54:53 +01:00
Elias Rohrer
14da64bdd8
rustfmt: Prepare util/test_utils.rs
.. we pull out `Mutex` field initialization into dedicated variables as
they might otherwise land on the same line when formatting, which might
lead to lockorder violation false-positives when compiled with the
`backtrace` feature.
2025-01-20 10:54:53 +01:00
Elias Rohrer
8f335e0ee6
rustfmt: Drop util/test_channel_signer.rs from exclusion list 2025-01-20 10:54:53 +01:00
Elias Rohrer
fe53ac9dca
rustfmt: Run on util/test_channel_signer.rs 2025-01-20 10:54:52 +01:00
Elias Rohrer
f4f95353db
rustfmt: Drop util/ser_macros.rs from exclusion list 2025-01-20 10:54:40 +01:00
Elias Rohrer
1cc309dd8b
rustfmt: Run on util/ser_macros.rs 2025-01-20 10:54:40 +01:00
Elias Rohrer
4568db8995
rustfmt: Prepare util/ser_macros.rs 2025-01-20 10:54:40 +01:00
Elias Rohrer
74d57dce0f
rustfmt: Drop util/ser.rs from exclusion list 2025-01-20 10:54:39 +01:00
Elias Rohrer
d436cf88e0
rustfmt: Run on util/ser.rs 2025-01-20 10:54:39 +01:00
Elias Rohrer
a8a516263a
rustfmt: Drop util/scid_utils.rs from exclusion list 2025-01-20 10:54:39 +01:00
Elias Rohrer
0fc48771eb
rustfmt: Run on util/scid_utils.rs 2025-01-20 10:54:39 +01:00
Matt Corallo
aa2c6fed24
Merge pull request #3408 from valentinewallace/2024-11-async-receive-offer-utils
Add static invoice creation utils to `ChannelManager`
2025-01-17 15:12:14 +00:00
Matt Corallo
3fbf97d75f
Merge pull request #3530 from TheBlueMatt/2025-01-0.1-relnotes
Add draft 0.1 release notes
2025-01-15 21:55:04 +00:00
Matt Corallo
2c5a1f67b6
Merge pull request #3544 from valentinewallace/2025-01-fix-build
Fix build for `cfg(async_payments)`
2025-01-15 21:42:15 +00:00
Valentine Wallace
4e3f8d7f18
Fix build for cfg(async_payments)
Static invoices don't have an amount_msats field.
2025-01-15 14:51:20 -05:00
Matt Corallo
5d1b6e0710 Add draft 0.1 release notes 2025-01-15 18:28:58 +00:00
Matt Corallo
6d604c52b2
Merge pull request #3535 from jkczyz/2025-01-invoice-amount
Validate `amount_msats` against invreq amount
2025-01-15 17:55:10 +00:00
Jeffrey Czyz
c2360be049
Add InvoiceRequest::has_amount_msats
When InvoiceRequest::amount_msats returns Some, it may have been
inferred from the Offer::amount and InvoiceRequest::quantity. Add a
method to InvoiceRequest for determining if the amount was explicitly
set.
2025-01-15 11:23:32 -06:00
Ian Slane
99889d27fd
Validate amount_msats against invreq amount
Add a check to ensure that the amount_msats in an invoice matches the
amount_msats specified in the invoice_request or offer (or refund).
Reject the invoice as invalid if there is a mismatch between these
amounts. Otherwise, an invoice may be paid with an amount greater than
the requested amount.

Co-authored-by: Ian Slane <slaneian@gmail.com>
Co-authored-by: Jeffrey Czyz <jkczyz@gmail.com>
2025-01-15 11:23:32 -06:00
Matt Corallo
bcbff6546f
Merge pull request #3533 from tnull/2025-01-allow-setting-process-callback-in-c-bindings
`liquidity`: Allow setting `process_events` callback in `c_bindings`
2025-01-15 14:11:38 +00:00
Elias Rohrer
e05b76af7b
liquidity: Allow setting process_events callback in c_bindings
To trigger message processing, we previously had the user set a callback
to `PeerManager::process_events` via an `Fn()` callback. This is however
not supported by `c_bindings`.

Here, we therefore introduce as `ProcessMesssagesCallback` trait that
can be used via `LiquidityManager::set_process_msgs_callback_fn`, which
is exposed in `c_bindings`.
2025-01-15 09:58:43 +01:00
Matt Corallo
de7d756688
Merge pull request #3538 from morehouse/fix_package_splitting
Fix package splitting logic
2025-01-15 01:09:44 +00:00
Matt Morehouse
a1d63560af
Fix package splitting logic
When scanning confirmed transactions for spends that conflict with our
existing packages, we should continue scanning after detecting the first
conflicting package since a transaction can conflict with multiple
packages.

This ensures that we remove *all* inputs from our packages that have
already been spent by the counterparty so that valid claim transactions
are generated.

Fixes https://github.com/lightningdevkit/rust-lightning/issues/3537.
2025-01-14 15:40:07 -06:00
Matt Corallo
ad462bd9c8
Merge pull request #3528 from tnull/2025-01-introduce-secondary-msrv-1.75
Move `lightning-transaction-sync` tests to dedicated script
2025-01-14 16:31:11 +00:00
Elias Rohrer
cd5b4f763e
Move lightning-transaction-sync tests to dedicated script
.. and bump its MSRV to 1.75.

Recently, `rustls` bumped their MSRV to 1.71. As we depend on them and
don't want to continuously pin this security-critical dependency back,
we have no choice left but to bump the MSRV for
`lightning-transaction-sync` to a version >= 1.71, too.

Here, we hence move the `lightning-transaction-sync` tests to a
dedicated script and propose to introduce a secondary MSRV of 1.75.

We chose this particular version, because:

a) it's > 1 year old
b) it provides a buffer to 1.71, i.e., if some crate bumped to a version
 > 1.71, there is a chance we don't immediately have to react again
c) it
 stabilized `async fn`s in traits (see
 https://blog.rust-lang.org/2023/12/21/async-fn-rpit-in-traits.html),
 which might become handy for related (BDK) crates, which hopefully will
 adopt the same target.
2025-01-14 14:31:29 +01:00
dunxen
7953b45e7b
Merge pull request #3513 from jkczyz/2024-12-refactor-channel-phase
Refactor `ChannelPhase` variants from `ChannelManager`
2025-01-14 14:52:18 +02:00
Elias Rohrer
c835e8002d
Merge pull request #3521 from TheBlueMatt/2025-01-fix-pin
Fix fuzz CI failures
2025-01-13 19:48:31 +01:00
valentinewallace
5f68d71cbe
Merge pull request #3522 from TheBlueMatt/2025-01-overflow-cltv
Fix max-value overflows in `set_max_path_length`
2025-01-13 12:34:54 -05:00
Matt Corallo
3e88b327ef Fix max-value overflows in set_max_path_length
When either the amount or the `max_total_cltv_expiry_delta` are
set to max-value, `set_max_path_length` can trigger overflows in
`build_onion_payloads_callback`, leading to debug-panics.
2025-01-13 14:51:26 +00:00
Matt Corallo
5a771c3de7 Clean up fuzz test build to fix disk space usage fuzz CI failures 2025-01-13 13:07:34 +00:00
Elias Rohrer
f92c4dc780
Merge pull request #3524 from TheBlueMatt/2025-01-spurious-assert
Drop spurious debug assertion in sweeping logic
2025-01-13 09:24:48 +01:00
Matt Corallo
0282b0d963 Drop spurious debug assertion in sweeping logic
With the `Confirm` interface, transaction confirmations can come
in at any time, so asserting that a confirmation is more recent
than the last time we broadcasted a transaction can lead to
spurious assertion failures.
2025-01-11 17:39:50 +00:00
Matt Corallo
c25dfaffb2
Merge pull request #3520 from jkczyz/2025-01-bindings-payment-paths
Support `Bolt12Invoice::payment_paths` in bindings
2025-01-10 20:28:11 +00:00
Jeffrey Czyz
4579e63e9e
Remove unnecessary lifetime parameter 2025-01-10 11:18:21 -06:00