]> git.bitcoin.ninja Git - rust-lightning/log
rust-lightning
10 months agoReorganize #[cfg(not(c_bindings))] imports
Jeffrey Czyz [Thu, 4 Jan 2024 23:39:18 +0000 (17:39 -0600)]
Reorganize #[cfg(not(c_bindings))] imports

10 months agoAdd ASCII art diagram explaining offers_tests
Jeffrey Czyz [Thu, 21 Dec 2023 00:05:42 +0000 (18:05 -0600)]
Add ASCII art diagram explaining offers_tests

10 months agoFunctional test for failing duplicate payments
Jeffrey Czyz [Wed, 20 Dec 2023 23:52:09 +0000 (17:52 -0600)]
Functional test for failing duplicate payments

10 months agoFunctional tests for failing without payment paths
Jeffrey Czyz [Wed, 20 Dec 2023 20:37:31 +0000 (14:37 -0600)]
Functional tests for failing without payment paths

10 months agoAdd Features::clear_route_blinding for testing
Jeffrey Czyz [Wed, 20 Dec 2023 20:32:53 +0000 (14:32 -0600)]
Add Features::clear_route_blinding for testing

10 months agoOffers functional tests for duplicated payment ids
Jeffrey Czyz [Tue, 19 Dec 2023 23:24:11 +0000 (17:24 -0600)]
Offers functional tests for duplicated payment ids

10 months agoFunctional tests for failing without blinded paths
Jeffrey Czyz [Tue, 19 Dec 2023 22:06:55 +0000 (16:06 -0600)]
Functional tests for failing without blinded paths

10 months agoFunctional tests for offers with blinded paths
Jeffrey Czyz [Fri, 15 Dec 2023 05:46:12 +0000 (23:46 -0600)]
Functional tests for offers with blinded paths

10 months agoFunctional tests for offers without blinded paths
Jeffrey Czyz [Fri, 3 Nov 2023 19:01:57 +0000 (14:01 -0500)]
Functional tests for offers without blinded paths

10 months agoFunctional tests for BOLT 12 Offers payment flow
Jeffrey Czyz [Tue, 31 Oct 2023 19:27:29 +0000 (14:27 -0500)]
Functional tests for BOLT 12 Offers payment flow

ChannelManager provides utilities to create offers and refunds along
with utilities to initiate and request payment for them, respectively.
It also manages the payment flow via implementing OffersMessageHandler.
Test that functionality, including the resulting event generation.

10 months agoConsolidate conditional imports
Jeffrey Czyz [Tue, 9 Jan 2024 21:05:29 +0000 (15:05 -0600)]
Consolidate conditional imports

10 months agoRemove redundant negations from feature check
Jeffrey Czyz [Tue, 9 Jan 2024 20:59:30 +0000 (14:59 -0600)]
Remove redundant negations from feature check

10 months agoRemove "no-std" feature checks
Jeffrey Czyz [Thu, 4 Jan 2024 16:30:51 +0000 (10:30 -0600)]
Remove "no-std" feature checks

An upcoming rust-bitcoin release will remove the "no-std" feature.
Replace "no-std" in feature checks with "std", negating as needed. Using
a single feature flag makes the checks more consistent across modules.

10 months agoHave TestRouter wrap DefaultRouter
Jeffrey Czyz [Thu, 14 Dec 2023 16:25:10 +0000 (10:25 -0600)]
Have TestRouter wrap DefaultRouter

TestRouter checks route and scoring expectations before delegating to
the standalone find_route function. Refactor it to wrap DefaultRouter
and delegate to it instead. This allows TestRouter to implement
create_blinded_payment_paths by delegating to DefaultRouter.

10 months agoSupport OnionMessenger in functional_test_utils
Jeffrey Czyz [Fri, 27 Oct 2023 18:27:55 +0000 (13:27 -0500)]
Support OnionMessenger in functional_test_utils

OnionMessenger is needed to write functional tests for ChannelManager's
OffersMessageHandler implementation. Also adds a TestMessageRouter,
which simply wraps DefaultMessageRouter for now.

10 months agoDRY up EntropySource implementation
Jeffrey Czyz [Wed, 3 Jan 2024 21:41:00 +0000 (15:41 -0600)]
DRY up EntropySource implementation

The ChaCha20-based EntropySource implementation is duplicated within the
sign module. Refactor those into a RandomBytes implementation so that it
may be reused both there. Also useful as a standalone EntropySource
implementation for tests where an independent EntropySource is needed to
ensure that backwards-compatibility testing is not broken.

10 months agoFix import order in functional_test_utils.rs
Jeffrey Czyz [Fri, 27 Oct 2023 15:39:41 +0000 (10:39 -0500)]
Fix import order in functional_test_utils.rs

10 months agoAdd peel_onion_message method to OnionMessenger
Jeffrey Czyz [Wed, 1 Nov 2023 18:12:44 +0000 (13:12 -0500)]
Add peel_onion_message method to OnionMessenger

When testing OnionMessenger in functional tests, it would be useful to
examine the contents of an OnionMessage response. Expose the standalone
peel_onion_message on OnionMessenger to facilitate this.

10 months agoMerge pull request #2824 from shuoer86/main
Elias Rohrer [Mon, 15 Jan 2024 09:38:03 +0000 (10:38 +0100)]
Merge pull request #2824 from shuoer86/main

Fix typos

10 months agoFix typo lightning/src/util/wakers.rs
shuoer86 [Fri, 12 Jan 2024 12:46:47 +0000 (20:46 +0800)]
Fix typo lightning/src/util/wakers.rs

10 months agoFix typo lightning/src/routing/router.rs
shuoer86 [Fri, 12 Jan 2024 12:46:40 +0000 (20:46 +0800)]
Fix typo lightning/src/routing/router.rs

10 months agoFix typo lightning/src/ln/peer_handler.rs
shuoer86 [Fri, 12 Jan 2024 12:46:33 +0000 (20:46 +0800)]
Fix typo lightning/src/ln/peer_handler.rs

10 months agoFix typo lightning-invoice/src/ser.rs
shuoer86 [Fri, 12 Jan 2024 12:46:26 +0000 (20:46 +0800)]
Fix typo lightning-invoice/src/ser.rs

10 months agoFix typo CONTRIBUTING.md
shuoer86 [Fri, 12 Jan 2024 12:46:16 +0000 (20:46 +0800)]
Fix typo CONTRIBUTING.md

10 months agoMerge pull request #2800 from optout21/channel-close-add-funding
Matt Corallo [Thu, 11 Jan 2024 19:35:26 +0000 (19:35 +0000)]
Merge pull request #2800 from optout21/channel-close-add-funding

Add channel funding txo to Channel Event::ChannelClosed

10 months agoMerge pull request #2822 from TheBlueMatt/2024-01-pm-dyn-ref
Elias Rohrer [Thu, 11 Jan 2024 17:41:01 +0000 (18:41 +0100)]
Merge pull request #2822 from TheBlueMatt/2024-01-pm-dyn-ref

Drop `PeerManager` type bound on `UtxoLookup` entirely

10 months agoMerge pull request #2801 from valentinewallace/2023-12-rb-groundwork-followups
valentinewallace [Thu, 11 Jan 2024 16:30:46 +0000 (11:30 -0500)]
Merge pull request #2801 from valentinewallace/2023-12-rb-groundwork-followups

#2128 follow-ups

10 months agoMerge pull request #2820 from TheBlueMatt/2024-01-fuzz-ooo-monitor-updates
valentinewallace [Thu, 11 Jan 2024 16:22:34 +0000 (11:22 -0500)]
Merge pull request #2820 from TheBlueMatt/2024-01-fuzz-ooo-monitor-updates

Test individual monitor update compl in chanmon_consistency fuzzer

10 months agoMerge pull request #2821 from TheBlueMatt/2024-01-om-direct-export
valentinewallace [Thu, 11 Jan 2024 14:52:00 +0000 (09:52 -0500)]
Merge pull request #2821 from TheBlueMatt/2024-01-om-direct-export

Expose `onion_message` items directly rather than via re-exports

10 months agoAdd channel funding txo to Channel Event::ChannelClosed
optout [Thu, 11 Jan 2024 08:15:53 +0000 (09:15 +0100)]
Add channel funding txo to Channel Event::ChannelClosed

10 months agoMerge pull request #2791 from valentinewallace/2023-12-multihop-recv-followups
Matt Corallo [Thu, 11 Jan 2024 00:04:39 +0000 (00:04 +0000)]
Merge pull request #2791 from valentinewallace/2023-12-multihop-recv-followups

Follow-ups to #2688

10 months agoExpose `onion_message` items directly rather than via re-exports 2024-01-om-direct-export
Matt Corallo [Wed, 10 Jan 2024 18:27:57 +0000 (18:27 +0000)]
Expose `onion_message` items directly rather than via re-exports

When we originally added the `onion_message` module, there weren't
a lot of public items in it, and it didn't make a lot of sense to
export the whole sub-module structure publicly. So, instead, we
exported the public items via re-exports directly in the
`onion_message` top-level module. However, as time went on, more
and more things entered the module, which left the top-level module
rather cluttered.

Worse, in 0.0.119, we exposed
`onion_message::messenger::SendSuccess` via the return type of
`send_message`, but forgot to re-export the enum itself, making
it impossible to actually use from external code.

Here we address both issues and simply replace the re-export with
the underlying sub-module structure.

10 months agoMerge pull request #2809 from TheBlueMatt/2023-12-closing-event-cleanup-fixes
Matt Corallo [Wed, 10 Jan 2024 22:37:07 +0000 (22:37 +0000)]
Merge pull request #2809 from TheBlueMatt/2023-12-closing-event-cleanup-fixes

Clean Up Funding Error Handling and shutdown

10 months agoDrop `PeerManager` type bound on `UtxoLookup` entirely 2024-01-pm-dyn-ref
Matt Corallo [Wed, 10 Jan 2024 22:24:43 +0000 (22:24 +0000)]
Drop `PeerManager` type bound on `UtxoLookup` entirely

In 67659677d4fdb6bf418d66dfa37c61706425232b we relaxed the bounds
set on `UtxoLookup` to enable those using `RoutingMessageHandler`
other than `P2PGossipSync` to use `UtxoLookup`. Sadly, because this
requires having a concrete `PeerManager` type which does *not* use
`UtxoLookup` in the `RoutingMessageHandler` type, this broke users
who were directly using `P2PGossipSync`.

We could split `UtxoLookup` into two, with different bounds, for
the two use-cases, but instead here we simply switch to storing a
reference to the `PeerManager` via a `dyn Fn` which allows us to
wake the `PeerManager` when we need to.

Fixes #2813

10 months agoRename parameter from err_packet to err_contents.
Valentine Wallace [Wed, 13 Dec 2023 21:27:54 +0000 (16:27 -0500)]
Rename parameter from err_packet to err_contents.

This name is more accurate since the method has been generalized to support
malformed HTLCs.

10 months agoRemove outdated comment.
Valentine Wallace [Wed, 13 Dec 2023 19:23:23 +0000 (14:23 -0500)]
Remove outdated comment.

10 months agoNormalize order of (sha256_of_onion, failure_code) in trait.
Valentine Wallace [Wed, 13 Dec 2023 19:20:51 +0000 (14:20 -0500)]
Normalize order of (sha256_of_onion, failure_code) in trait.

This helps avoid destructuring the tuple.

10 months agoDRY malformed HTLC handling during htlc batch processing.
Valentine Wallace [Wed, 13 Dec 2023 19:15:58 +0000 (14:15 -0500)]
DRY malformed HTLC handling during htlc batch processing.

10 months agoFix logger usage during batched htlc processing of malforms.
Valentine Wallace [Wed, 13 Dec 2023 19:09:16 +0000 (14:09 -0500)]
Fix logger usage during batched htlc processing of malforms.

Introduced due to a rebase error.

10 months agoClean up code DRY'd in previous commit.
Valentine Wallace [Wed, 10 Jan 2024 16:19:09 +0000 (11:19 -0500)]
Clean up code DRY'd in previous commit.

10 months agoRename OutboundOnionPayload::BlindedReceive::amt_msat to be more descriptive.
Valentine Wallace [Thu, 14 Dec 2023 20:34:51 +0000 (15:34 -0500)]
Rename OutboundOnionPayload::BlindedReceive::amt_msat to be more descriptive.

10 months agoRename OutboundOnionPayload::Receive::amt_msat to be more descriptive.
Valentine Wallace [Thu, 14 Dec 2023 20:32:34 +0000 (15:32 -0500)]
Rename OutboundOnionPayload::Receive::amt_msat to be more descriptive.

10 months agoRename InboundOnionPayload::BlindedReceive::amt_msat to be more descriptive.
Valentine Wallace [Thu, 14 Dec 2023 20:21:15 +0000 (15:21 -0500)]
Rename InboundOnionPayload::BlindedReceive::amt_msat to be more descriptive.

10 months agoRename InboundOnionPayload::Receive::amt_msat to be more descriptive.
Valentine Wallace [Thu, 14 Dec 2023 20:15:41 +0000 (15:15 -0500)]
Rename InboundOnionPayload::Receive::amt_msat to be more descriptive.

10 months agoRename OutboundOnionPayload::BlindedReceive::outgoing_cltv_value.
Valentine Wallace [Wed, 13 Dec 2023 22:22:50 +0000 (17:22 -0500)]
Rename OutboundOnionPayload::BlindedReceive::outgoing_cltv_value.

There is no outgoing HTLC for received HTLCs, so rename to be more accurate.

10 months agoRename OutboundOnionPayload::Receive::outgoing_cltv_value.
Valentine Wallace [Wed, 13 Dec 2023 22:18:56 +0000 (17:18 -0500)]
Rename OutboundOnionPayload::Receive::outgoing_cltv_value.

There is no outgoing HTLC for received HTLCs, so rename to be more accurate.

10 months agoRename InboundOnionPayload::BlindedReceive::outgoing_cltv_value.
Valentine Wallace [Wed, 13 Dec 2023 21:43:27 +0000 (16:43 -0500)]
Rename InboundOnionPayload::BlindedReceive::outgoing_cltv_value.

There is no outgoing HTLC for received HTLCs, so rename to be more accurate.

10 months agoRename InboundOnionPayload::Receive::outgoing_cltv_value
Valentine Wallace [Tue, 12 Dec 2023 22:45:46 +0000 (17:45 -0500)]
Rename InboundOnionPayload::Receive::outgoing_cltv_value

.. since there is no outgoing cltv for received HTLCs.

10 months agoRename outgoing_cltv_value internal var.
Valentine Wallace [Tue, 12 Dec 2023 22:59:41 +0000 (17:59 -0500)]
Rename outgoing_cltv_value internal var.

There is no outgoing CLTV for received HTLCs, so this new var makes more sense.

10 months agoRename InboundOnionErr to InboundHTLCErr.
Valentine Wallace [Tue, 12 Dec 2023 22:39:10 +0000 (17:39 -0500)]
Rename InboundOnionErr to InboundHTLCErr.

The prior name seems to reference onion decode errors specifically, when in
fact the error contents are generic failure codes for any error that occurs
during HTLC receipt.

10 months agoRemove trailing whitespace.
Valentine Wallace [Wed, 10 Jan 2024 15:55:55 +0000 (10:55 -0500)]
Remove trailing whitespace.

10 months agoMerge pull request #2748 from TheBlueMatt/2023-11-2675-followups
Matt Corallo [Tue, 9 Jan 2024 23:22:48 +0000 (23:22 +0000)]
Merge pull request #2748 from TheBlueMatt/2023-11-2675-followups

Doc and style followups from #2675

10 months agoUpdate docs on `HTLC` and `DelayedPayment` keys for clarity 2023-11-2675-followups
Matt Corallo [Mon, 27 Nov 2023 18:52:37 +0000 (18:52 +0000)]
Update docs on `HTLC` and `DelayedPayment` keys for clarity

This also adds required linebreaks to keep the docs to a reasonable
width.

10 months agoDrop the unused `PaymentKey` type
Matt Corallo [Mon, 27 Nov 2023 18:51:13 +0000 (18:51 +0000)]
Drop the unused `PaymentKey` type

935a716cc6c4fada075e2b740a70bb1b7b349d49 added new wrappers for the
various channel keys, including a payment_key. However, the
`payment_key` has been unused in lightning since the introduction
(and broad requiring) of the `static_remotekey` feature.

Thus, we simply remove it (and an incredibly stale TODO) here.

10 months agoUpdate docs for slightly more clarity on channel key derivation
Matt Corallo [Mon, 27 Nov 2023 18:32:08 +0000 (18:32 +0000)]
Update docs for slightly more clarity on channel key derivation

10 months agoMerge pull request #2807 from Jossec101/log-errors-do-accept-inbound-channel
Matt Corallo [Tue, 9 Jan 2024 20:08:25 +0000 (20:08 +0000)]
Merge pull request #2807 from Jossec101/log-errors-do-accept-inbound-channel

Log the errors before we return them from ChannelManager::do_accept_inbound_channel

10 months agoTest individual monitor update compl in chanmon_consistency fuzzer 2024-01-fuzz-ooo-monitor-updates
Matt Corallo [Tue, 9 Jan 2024 17:11:03 +0000 (17:11 +0000)]
Test individual monitor update compl in chanmon_consistency fuzzer

When users do async monitor updating, it may not be the case that
all pending monitors will complete updating at once. Thus, we
should fuzz monitor updates completing out of order, which we do
here.

10 months agoMerge pull request #2817 from tnull/2024-01-time-in-electrum
Matt Corallo [Tue, 9 Jan 2024 16:57:16 +0000 (16:57 +0000)]
Merge pull request #2817 from tnull/2024-01-time-in-electrum

Feature-gate `time` use also in `ElectrumSyncClient`

10 months agoImproved error logging in ChannelManager::do_accept_inbound_channel
José A.P [Tue, 9 Jan 2024 10:26:14 +0000 (11:26 +0100)]
Improved error logging in ChannelManager::do_accept_inbound_channel

This refactor ensures that all API errors in do_accept_inbound_channel
are logged before they are returned.

10 months agoFeature-gate `time` use also in `ElectrumSyncClient`
Elias Rohrer [Tue, 9 Jan 2024 08:37:14 +0000 (09:37 +0100)]
Feature-gate `time` use also in `ElectrumSyncClient`

A previous commit introduced the `time` feature to gate the use of
`SystemTime` dependent APIs in `EsploraSyncClient`. It however omitted
doing the same for the Electrum side of things. Here, we address this
oversight.

10 months agoMerge pull request #2802 from TheBlueMatt/2023-12-no-pub-enum
Matt Corallo [Mon, 8 Jan 2024 21:33:00 +0000 (21:33 +0000)]
Merge pull request #2802 from TheBlueMatt/2023-12-no-pub-enum

Move `CandidateRouteHop` enum variant fields into structs

10 months agoMerge pull request #2808 from TheBlueMatt/2023-12-fuzzing-fixes-1
Matt Corallo [Mon, 8 Jan 2024 20:58:30 +0000 (20:58 +0000)]
Merge pull request #2808 from TheBlueMatt/2023-12-fuzzing-fixes-1

10 months agoFix reachable unwrap on non-channel_type manual channel acceptance 2023-12-fuzzing-fixes-1
Matt Corallo [Sun, 24 Dec 2023 17:12:10 +0000 (17:12 +0000)]
Fix reachable unwrap on non-channel_type manual channel acceptance

If we receive an `OpenChannel` message without a `channel_type`
with `manually_accept_inbound_channels` set, we will `unwrap()`
`None`.

This is uncommon these days as most nodes support `channel_type`,
but sadly is rather trivial for a peer to hit for those with manual
channel acceptance enabled.

Reported in and fixes #2804. Luckily, the updated
`full_stack_target` has no issue reaching this issue quickly.

10 months agoMerge pull request #2799 from benthecarman/tx-sync-wasm
Elias Rohrer [Mon, 8 Jan 2024 17:55:07 +0000 (18:55 +0100)]
Merge pull request #2799 from benthecarman/tx-sync-wasm

Don't call system time in no-std

10 months agoMove `CandidateRouteHop` enum variant fields into structs 2023-12-no-pub-enum
Matt Corallo [Tue, 19 Dec 2023 18:21:21 +0000 (18:21 +0000)]
Move `CandidateRouteHop` enum variant fields into structs

The bindings generator struggles a bit with the references in enum
variant fields in `CandidateRouteHop`. While we could probably fix
this, its much eaiser (and less risky) to inline the enum variant
fields from `CandidateRouteHop` into structs. This also lets us
make some of the fields non-public, which seems better at least for
the opaque `hint_idx` in the blinded paths.

10 months agoFix handling of duplicate initial `ChannelMonitor` writing 2023-12-closing-event-cleanup-fixes
Matt Corallo [Mon, 25 Dec 2023 06:55:08 +0000 (06:55 +0000)]
Fix handling of duplicate initial `ChannelMonitor` writing

In e06484b0f44155e647ff29810d2f187967e45813, we added specific
handling for outbound-channel initial monitor updates failing -
in such a case we have a counterparty who tried to open a second
channel with the same funding info we just gave them, causing us
to force-close our outbound channel as it shows up as
duplicate-funding. Its largely harmless as it leads to a spurious
force-closure of a channel with a peer doing something absurd,
however it causes the `full_stack_target` fuzzer to fail.

Sadly, in 574c77e7bc95fd8dea5a8058b6b35996cc99db8d, as we were
dropping handling of `PermanentFailure` handling for updates, we
accidentally dropped handling for initial updates as well.

Here we fix the issue (again) and add a test.

10 months agoDo not panic if a peer learns our funding info before we fund
Matt Corallo [Tue, 26 Dec 2023 18:16:51 +0000 (18:16 +0000)]
Do not panic if a peer learns our funding info before we fund

We'd previously assumed that LDK would receive
`funding_transaction_generated` prior to our peer learning the txid
and panicked if the peer tried to open a redundant channel to us
with the same funding outpoint.

While this assumption is generally safe, some users may have
out-of-band protocols where they notify their LSP about a funding
outpoint first, or this may be violated in the future with
collaborative transaction construction protocols, i.e. the upcoming
dual-funding protocol.

10 months agoDrop now-unused fields from `MsgHandleErrInternal`
Matt Corallo [Fri, 29 Dec 2023 03:55:52 +0000 (03:55 +0000)]
Drop now-unused fields from `MsgHandleErrInternal`

10 months agoMove ChannelClosed generation into finish_close_channel
Matt Corallo [Fri, 29 Dec 2023 03:23:59 +0000 (03:23 +0000)]
Move ChannelClosed generation into finish_close_channel

Currently the channel shutdown sequence has a number of steps which
all the shutdown callsites have to call. Because many shutdown
cases are rare error cases, its relatively easy to miss a call and
leave users without `Event`s or miss some important cleanup.

One of those steps, calling `issue_channel_close_events`, is rather
easy to remove, as it only generates two events, which can simply
be moved to another shutdown step.

Here we remove `issue_channel_close_events` by moving
`ChannelClosed` event generation into `finish_force_close_channel`.

10 months agoMove DiscardFunding generation into finish_close_channel
Matt Corallo [Fri, 29 Dec 2023 03:15:18 +0000 (03:15 +0000)]
Move DiscardFunding generation into finish_close_channel

Currently the channel shutdown sequence has a number of steps which
all the shutdown callsites have to call. Because many shutdown
cases are rare error cases, its relatively easy to miss a call and
leave users without `Event`s or miss some important cleanup.

One of those steps, calling `issue_channel_close_events`, is rather
easy to remove, as it only generates two events, which can simply
be moved to another shutdown step.

Here we move the first of the two events, `DiscardFunding`, into
`finish_force_close_channel`.

10 months agoConsider `MONITOR_UPDATE_IN_PROGRESS` as unbroadcasted funding
Matt Corallo [Fri, 29 Dec 2023 00:45:07 +0000 (00:45 +0000)]
Consider `MONITOR_UPDATE_IN_PROGRESS` as unbroadcasted funding

If we promote our channel to `AwaitingChannelReady` after adding
funding info, but still have `MONITOR_UPDATE_IN_PROGRESS` set, we
haven't broadcasted the funding transaction yet and thus should
return values from `unbroadcasted_funding[_txid]` and generate a
`DiscardFunding` event.

10 months agoFix dust buffer feerate calculation overflow
Matt Corallo [Sun, 24 Dec 2023 06:24:38 +0000 (06:24 +0000)]
Fix dust buffer feerate calculation overflow

If a peer provides a feerate which nears `u32::MAX`, we may
overflow calculating the dust buffer feerate, leading to spuriously
keeping non-anchor channels open when they should be force-closed.

10 months agoFix debug assertion on opening a channel with a disconnected peer
Matt Corallo [Sun, 24 Dec 2023 06:10:38 +0000 (06:10 +0000)]
Fix debug assertion on opening a channel with a disconnected peer

If we try to open a channel with a peer that is disconnected (but
with which we have some other channels), we'll end up with an
unfunded channel which will lead to a panic when the peer
reconnects. Here we drop this debug assertion without bother to add
a new test, given this behavior will change in a PR very soon.

10 months agoFix `REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH` for contest delays >0x7fff
Matt Corallo [Sun, 24 Dec 2023 05:55:11 +0000 (05:55 +0000)]
Fix `REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH` for contest delays >0x7fff

When contest delays are >= 0x8000, script pushes require an extra
byte to avoid being interpreted as a negative int. Thus, for
channels with CSV delays longer than ~7.5 months we may generate
transactions with slightly too little fee. This isn't really a huge
deal, but we should prefer to be conservative here, and slightly
too high fee in the general case is better than slightly too little
fee in other cases.

10 months agoStop including dust values in feerate affordability checks
Matt Corallo [Sun, 24 Dec 2023 05:17:29 +0000 (05:17 +0000)]
Stop including dust values in feerate affordability checks

When we or our counterparty are updating the fees on the channel,
we currently check that the resulting balance is sufficient not
only to meet the reserve threshold, but also not push it below
dust. This isn't required in the BOLTs and may lead to spurious
force-closures (which would be a bit safer, but reserve should
always exceed the dust threshold).

Worse, the current logic is broken - it compares the output value
in *billionths of satoshis* to the dust limit in satoshis. Thus,
the code is borderline dead anyway, but can overflow for channels
with several million Bitcoin, causing the fuzzer to get mad (and
lead to spurious force-closures for few-billion-dollar channels).

11 months agoFix `Feature` eq + hash to ignore excess zero bytes
Matt Corallo [Sun, 24 Dec 2023 04:49:24 +0000 (04:49 +0000)]
Fix `Feature` eq + hash to ignore excess zero bytes

If we get a `Feature` object which has excess zero bytes, we
shouldn't consider it a different `Feature` from another with the
same bits set, but no excess zero bytes. Here we fix both the
`Hash` and `PartialEq` implementation for `Features` to ignore
excess zero bytes.

11 months agoMerge pull request #2788 from tnull/2023-12-enforce-no-warnings-ci
Matt Corallo [Wed, 20 Dec 2023 19:54:59 +0000 (19:54 +0000)]
Merge pull request #2788 from tnull/2023-12-enforce-no-warnings-ci

Deny warnings in CI

11 months agoDon't call system time in unless feature enabled
benthecarman [Sun, 17 Dec 2023 00:08:02 +0000 (18:08 -0600)]
Don't call system time in unless feature enabled

11 months agoAllow `unused_variables` for one `_test_vectors` method
Elias Rohrer [Sat, 16 Dec 2023 18:04:52 +0000 (19:04 +0100)]
Allow `unused_variables` for one `_test_vectors` method

11 months agoAllow unused imports in `lightning-invoice` prelude
Elias Rohrer [Sat, 16 Dec 2023 17:59:49 +0000 (18:59 +0100)]
Allow unused imports in `lightning-invoice` prelude

11 months agoDrop unused `windows` imports in `FilesystemStore` tests
Elias Rohrer [Sat, 16 Dec 2023 13:39:53 +0000 (14:39 +0100)]
Drop unused `windows` imports in `FilesystemStore` tests

11 months agoDrop unenforced bound in trait alias
Elias Rohrer [Sat, 16 Dec 2023 13:15:21 +0000 (14:15 +0100)]
Drop unenforced bound in trait alias

... to fix:
```
  error: bounds on generic parameters are not enforced in type aliases
   --> lightning/src/onion_message/messenger.rs:267:33
```

11 months agoFix unused import warnings in `c_bindings`
Elias Rohrer [Sat, 16 Dec 2023 13:04:12 +0000 (14:04 +0100)]
Fix unused import warnings in `c_bindings`

11 months agoFix unused imports in `lightning-invoice` no-std tests
Elias Rohrer [Sat, 16 Dec 2023 12:55:48 +0000 (13:55 +0100)]
Fix unused imports in `lightning-invoice` no-std tests

11 months agoDrop unused `sync` module from `lightning-invoice`
Elias Rohrer [Sat, 16 Dec 2023 12:39:22 +0000 (13:39 +0100)]
Drop unused `sync` module from `lightning-invoice`

11 months agoFix unused (import) warnings in `no-std` builds
Elias Rohrer [Tue, 12 Dec 2023 17:02:59 +0000 (18:02 +0100)]
Fix unused (import) warnings in `no-std` builds

11 months agoFix redundant import warning in BP's `futures`
Elias Rohrer [Tue, 12 Dec 2023 16:46:57 +0000 (17:46 +0100)]
Fix redundant import warning in BP's `futures`

11 months agoFeature-gate `GetUtxosResponse` in `lightning-block-sync`
Elias Rohrer [Tue, 12 Dec 2023 16:36:04 +0000 (17:36 +0100)]
Feature-gate `GetUtxosResponse` in `lightning-block-sync`

.. as it's only used by the REST client.

11 months agoDeny warnings in CI
Elias Rohrer [Tue, 12 Dec 2023 16:25:09 +0000 (17:25 +0100)]
Deny warnings in CI

Since we recently got rid of our last build/test/doc warnings, we now
deny warnings via `-D warnings` in CI, enforcing no new ones are
introduced.

11 months agoMerge pull request #2794 from TheBlueMatt/2023-12-cut-119 v0.0.119
Matt Corallo [Sat, 16 Dec 2023 02:57:20 +0000 (02:57 +0000)]
Merge pull request #2794 from TheBlueMatt/2023-12-cut-119

Cut 0.0.119

11 months agoBump versions to 0.0.119/`lightning-invoice` 0.27 2023-12-cut-119
Matt Corallo [Fri, 15 Dec 2023 22:46:54 +0000 (22:46 +0000)]
Bump versions to 0.0.119/`lightning-invoice` 0.27

11 months agoAdd CHANGELOG entries for 0.0.119
Matt Corallo [Thu, 14 Dec 2023 04:27:59 +0000 (04:27 +0000)]
Add CHANGELOG entries for 0.0.119

11 months agoMerge pull request #2798 from TheBlueMatt/2023-12-119-bindings-upstream
Matt Corallo [Fri, 15 Dec 2023 23:40:57 +0000 (23:40 +0000)]
Merge pull request #2798 from TheBlueMatt/2023-12-119-bindings-upstream

Small API cleanups pre-0.0.119

11 months agoMerge pull request #2795 from TheBlueMatt/2023-11-robuster-chan-to-peer
Wilmer Paulino [Fri, 15 Dec 2023 23:36:52 +0000 (15:36 -0800)]
Merge pull request #2795 from TheBlueMatt/2023-11-robuster-chan-to-peer

 Move channel -> peer tracking to OutPoints from Channel IDs

11 months agoFix dev MSRV build of lightning-transaction-sync 2023-12-119-bindings-upstream
Matt Corallo [Fri, 15 Dec 2023 22:39:57 +0000 (22:39 +0000)]
Fix dev MSRV build of lightning-transaction-sync

...due to a transitive dependency of the `bitcoind` crate.

11 months agoUse correct default value when comparing to `htlc_maximum_msat`
Matt Corallo [Fri, 15 Dec 2023 22:32:24 +0000 (22:32 +0000)]
Use correct default value when comparing to `htlc_maximum_msat`

62f866965436fff1a8e98ee655a8a6dcbb8716c1 added two
`htlc_maximum_msat.unwrap_or`s, but used a default value of 0,
spuriously causing all HTLCs to fail if we don't have an htlc
maximum value. This should be mostly harmless, but we should fix it
anyway.

11 months agoMake `FinalOnionHopData` public
Matt Corallo [Fri, 15 Dec 2023 18:23:42 +0000 (18:23 +0000)]
Make `FinalOnionHopData` public

In 4b5db8c3ce, `channelmanager::PendingHTLCRouting` was made
public, exposing a `FinalOnionHopData` field to the world. However,
`FinalOnionHopData` was left crate-private, making the enum
impossible to construct.

There isn't a strong reason for this (even though the
`FinalOnionHopData` API is somewhat confusing, being separated from
the rest of the onion structs), so we expose it here.

11 months agoDrop explicit `bitcoin_hashes` dependency in `lightning-invoice`
Matt Corallo [Fri, 15 Dec 2023 18:14:56 +0000 (18:14 +0000)]
Drop explicit `bitcoin_hashes` dependency in `lightning-invoice`

Since `lightning-invoice` now depends on the `bitcoin` crate
directly, also depending on the `bitcoin_hashes` crate is redundant
and just means we confuse users by setting the `std` flag only on
`bitcoin`. Thus, we drop the explicit dependency here and replace
it with `bitcoin::hashes`.

11 months agoUn-export the `PrivateRoute` inner field as there are invariants
Matt Corallo [Thu, 14 Dec 2023 22:49:58 +0000 (22:49 +0000)]
Un-export the `PrivateRoute` inner field as there are invariants

When we make the `PrivateRoute` inner `RouteHint` `pub`, we failed
to note that the `PrivateRoute::new` constructor actually verifies
a length invariant. Thus, we un-export the inner field and force
users to go back through the `new` fn.

11 months agoMerge pull request #2781 from jkczyz/2023-09-multihop-paths
Matt Corallo [Fri, 15 Dec 2023 22:30:43 +0000 (22:30 +0000)]
Merge pull request #2781 from jkczyz/2023-09-multihop-paths

Multi-hop `BlindedPath` creation interface