]> git.bitcoin.ninja Git - rust-lightning/log
rust-lightning
3 weeks agoFix outdated comment on PendingOutboundPayment::StaticInvoiceReceived
Valentine Wallace [Wed, 30 Oct 2024 16:36:46 +0000 (12:36 -0400)]
Fix outdated comment on PendingOutboundPayment::StaticInvoiceReceived

3 weeks agoFactor invoice requests into payment path length limiting
Valentine Wallace [Wed, 18 Sep 2024 15:27:09 +0000 (11:27 -0400)]
Factor invoice requests into payment path length limiting

Async payments include the original invoice request in the payment onion.
Since invreqs may include blinded paths, it's important to factor them into our
max path length calculations since they may take up a significant portion of
the 1300-byte onion.

3 weeks agoInclude invreq in payment onion when retrying async payments
Valentine Wallace [Wed, 18 Sep 2024 15:21:26 +0000 (11:21 -0400)]
Include invreq in payment onion when retrying async payments

While in the last commit we began including invoice requests in async payment
onions on initial send, further work is needed to include them on retry. Here
we begin storing invreqs in our retry data, and pass them along for inclusion
in the onion on payment retry.

Per BOLTs PR 1149, when paying a static invoice we need to include our original
invoice request in the HTLC onion since the recipient wouldn't have received it
previously.

3 weeks agoInclude invreq in payment onion when sending async payments
Valentine Wallace [Wed, 18 Sep 2024 15:17:49 +0000 (11:17 -0400)]
Include invreq in payment onion when sending async payments

Past commits have set us up to include invoice requests in outbound async
payment onions. Here we actually pull the invoice request from where it's
stored in outbound_payments and pass it into the correct utility for inclusion
in the onion on initial send.

Per BOLTs PR 1149, when paying a static invoice we need to include our original
invoice request in the HTLC onion since the recipient wouldn't have received it
previously.

3 weeks agoStore invreqs in StaticInvoiceReceived outbound payments
Valentine Wallace [Fri, 28 Jun 2024 18:03:46 +0000 (14:03 -0400)]
Store invreqs in StaticInvoiceReceived outbound payments

When transitioning outbound payments from AwaitingInvoice to
StaticInvoiceReceived, include the invreq in the new state's outbound payment
storage for future inclusion in an async payment onion.

Per BOLTs PR 1149, when paying a static invoice we need to include our original
invoice request in the HTLC onion since the recipient wouldn't have received it
previously.

3 weeks agoSupport including invreqs when paying to a route
Valentine Wallace [Fri, 28 Jun 2024 17:57:15 +0000 (13:57 -0400)]
Support including invreqs when paying to a route

Add a new invoice request parameter to outbound_payments and channelmanager
send-to-route internal utils. As of this commit the invreq will always be
passed in as None, to be updated in future commits.

Per BOLTs PR 1149, when paying a static invoice we need to include our original
invoice request in the HTLC onion since the recipient wouldn't have received it
previously.

3 weeks agoSupport including invreqs when building payment onions
Valentine Wallace [Fri, 28 Jun 2024 17:45:28 +0000 (13:45 -0400)]
Support including invreqs when building payment onions

Add a new invoice request parameter to onion_utils::create_payment_onion. As of
this commit it will always be passed in as None, to be updated in future
commits.

Per BOLTs PR 1149, when paying a static invoice we need to include our original
invoice request in the HTLC onion since the recipient wouldn't have received it
previously.

3 weeks agoSupport including invreqs when building onion payloads
Valentine Wallace [Fri, 28 Jun 2024 16:11:01 +0000 (12:11 -0400)]
Support including invreqs when building onion payloads

Add a new invoice request parameter to onion_utils::build_onion_payloads.
As of this commit it will always be passed in as None, to be updated in future
commits.

Per BOLTs PR 1149, when paying a static invoice we need to include our original
invoice request in the HTLC onion since the recipient wouldn't have received it
previously.

3 weeks agoSupport encoding invreqs in outbound onion payloads
Valentine Wallace [Fri, 28 Jun 2024 15:40:53 +0000 (11:40 -0400)]
Support encoding invreqs in outbound onion payloads

Per BOLTs PR 1149, when paying a static invoice we need to include our original
invoice request in the HTLC onion since the recipient wouldn't have received it
previously.

We use an experimental TLV type for this new onion payload field, since the
spec is still not merged in the BOLTs.

3 weeks agoStop taking &self in outbound_payments' create_inbound_payment
Valentine Wallace [Wed, 30 Oct 2024 15:39:52 +0000 (11:39 -0400)]
Stop taking &self in outbound_payments' create_inbound_payment

The method doesn't actually use its &self parameter, and this makes it more
obvious that we aren't going to deadlock by calling the method if the
outbound_payments lock is already acquired.

3 weeks agoPrefix AsyncPaymentsMessageHandler methods with handle_*
Valentine Wallace [Wed, 18 Sep 2024 00:32:14 +0000 (20:32 -0400)]
Prefix AsyncPaymentsMessageHandler methods with handle_*

"Release" is overloaded in the trait's release_pending_messages method, since
the latter releases pending async payments onion messages to the peer manager,
vs the release_held_htlc method handles the release_held_htlc onion message by
attempting to send an HTLC to the recipient.

3 weeks agoUpdate docs for PaymentFailureReason::RouteNotFound
Valentine Wallace [Wed, 11 Sep 2024 17:57:19 +0000 (13:57 -0400)]
Update docs for PaymentFailureReason::RouteNotFound

Since we started using this error in send_payment_for_bolt12_invoice, this
error type is no longer only used on retry but also on initial send.

3 weeks agoAdd new PaymentFailureReason::BlindedPathCreationFailed
Valentine Wallace [Wed, 11 Sep 2024 17:53:39 +0000 (13:53 -0400)]
Add new PaymentFailureReason::BlindedPathCreationFailed

RouteNotFound did not fit here because that error is reserved for failing to
find a route for a payment, whereas here we are failing to create a blinded
path back to ourselves..

4 weeks agoFix unused warning in fuzz.
Valentine Wallace [Wed, 18 Sep 2024 00:22:20 +0000 (20:22 -0400)]
Fix unused warning in fuzz.

4 weeks agoMerge pull request #3007 from arik-so/arik/trampoline/2024-04-trampoline-blinded...
Matt Corallo [Wed, 23 Oct 2024 21:52:10 +0000 (21:52 +0000)]
Merge pull request #3007 from arik-so/arik/trampoline/2024-04-trampoline-blinded-hop-serialization

Serialize blinded Trampoline hops

4 weeks agoTest non-legacy blinded Trampoline payloads.
Arik Sosman [Sun, 22 Sep 2024 14:06:24 +0000 (23:06 +0900)]
Test non-legacy blinded Trampoline payloads.

4 weeks agoAdd non-legacy blinded Trampoline payloads.
Arik Sosman [Sun, 22 Sep 2024 14:06:05 +0000 (23:06 +0900)]
Add non-legacy blinded Trampoline payloads.

4 weeks agoTest blinded Trampoline payload serialization.
Arik Sosman [Thu, 27 Jun 2024 14:30:21 +0000 (10:30 -0400)]
Test blinded Trampoline payload serialization.

4 weeks agoSerialize blinded path forwards in Trampoline onions.
Arik Sosman [Thu, 18 Apr 2024 21:52:29 +0000 (14:52 -0700)]
Serialize blinded path forwards in Trampoline onions.

4 weeks agoMerge pull request #3379 from arik-so/exclude-windows-msrv
Matt Corallo [Wed, 23 Oct 2024 13:53:18 +0000 (13:53 +0000)]
Merge pull request #3379 from arik-so/exclude-windows-msrv

Skip MSRV on Windows in CI

4 weeks agoMerge pull request #3142 from TheBlueMatt/2024-06-robust-updates
Matt Corallo [Wed, 23 Oct 2024 00:12:03 +0000 (00:12 +0000)]
Merge pull request #3142 from TheBlueMatt/2024-06-robust-updates

Reliably deliver gossip messages from our `ChannelMessageHandler`

4 weeks agoSkip MSRV on Windows in CI
Arik Sosman [Tue, 22 Oct 2024 20:09:24 +0000 (13:09 -0700)]
Skip MSRV on Windows in CI

4 weeks agoMerge pull request #3376 from yellowred/yellowred/monitor_update_name_pub
Matt Corallo [Tue, 22 Oct 2024 17:13:05 +0000 (17:13 +0000)]
Merge pull request #3376 from yellowred/yellowred/monitor_update_name_pub

Make monitor update name public

4 weeks agoMake monitor update name public
olegkubrakov [Thu, 17 Oct 2024 21:28:12 +0000 (14:28 -0700)]
Make monitor update name public

These structs are meant for MonitoringUpdatingPersister implementation, but some
external implementations may still reuse them, so going to make them public.

4 weeks agoMerge pull request #3377 from G8XSU/hex-impls
Matt Corallo [Tue, 22 Oct 2024 13:55:34 +0000 (13:55 +0000)]
Merge pull request #3377 from G8XSU/hex-impls

Implement to_lower_hex() Display/Debug for PaymentId & OfferId

4 weeks agoMerge pull request #3267 from arik-so/rgs_metrics_2024-08
Gursharan Singh [Mon, 21 Oct 2024 23:15:43 +0000 (16:15 -0700)]
Merge pull request #3267 from arik-so/rgs_metrics_2024-08

Update RGS stats for August 2024.

4 weeks agoImplement to_lower_hex() Display/Debug for OfferId.
G8XSU [Mon, 21 Oct 2024 22:36:11 +0000 (15:36 -0700)]
Implement to_lower_hex() Display/Debug for OfferId.

4 weeks agoImplement to_lower_hex() Display/Debug for PaymentId.
G8XSU [Mon, 21 Oct 2024 22:32:30 +0000 (15:32 -0700)]
Implement to_lower_hex() Display/Debug for PaymentId.

4 weeks agoUpdate processing times for iPhone.
Arik Sosman [Wed, 11 Sep 2024 19:01:34 +0000 (12:01 -0700)]
Update processing times for iPhone.

4 weeks agoUpdate RGS stats for August 2024.
Arik Sosman [Thu, 22 Aug 2024 16:55:20 +0000 (09:55 -0700)]
Update RGS stats for August 2024.

4 weeks agoMerge pull request #3370 from dunxen/2024-10-dry-funding-created-signed
Matt Corallo [Mon, 21 Oct 2024 19:25:18 +0000 (19:25 +0000)]
Merge pull request #3370 from dunxen/2024-10-dry-funding-created-signed

DRY `funding_created()` and `funding_signed()` for V1 channels

4 weeks agoDRY `funding_created()` and `funding_signed()` for V1 channels
Duncan Dean [Fri, 4 Oct 2024 14:35:43 +0000 (16:35 +0200)]
DRY `funding_created()` and `funding_signed()` for V1 channels

There is a decent amount of shared code in these two methods so we make
an attempt to share that code here by introducing the
`InitialRemoteCommitmentReceiver` trait. This trait will also come in
handy when we need similar commitment_signed handling behaviour for
dual-funded channels.

4 weeks agoMerge pull request #3356 from jkczyz/2024-10-inflight-scoring
Matt Corallo [Sat, 19 Oct 2024 13:41:11 +0000 (13:41 +0000)]
Merge pull request #3356 from jkczyz/2024-10-inflight-scoring

Don't over-penalize channels with inflight HTLCs

4 weeks agoUse total_inflight_amount_msat for probability fns
Jeffrey Czyz [Fri, 18 Oct 2024 22:42:18 +0000 (17:42 -0500)]
Use total_inflight_amount_msat for probability fns

Rename parameters used when calculating success probability to make it
clear that the total mount in-flight should be used rather than the
payment amount.

4 weeks agoCorrect comments in avoids_saturating_channels
Jeffrey Czyz [Wed, 16 Oct 2024 20:18:17 +0000 (15:18 -0500)]
Correct comments in avoids_saturating_channels

4 weeks agoCorrect base_penalty_amount_multiplier_msat docs
Jeffrey Czyz [Thu, 10 Oct 2024 23:20:25 +0000 (18:20 -0500)]
Correct base_penalty_amount_multiplier_msat docs

Commit df52da7b31494c7ec77a705cca4c44bc840f8a95 modified
ProbabilisticScorer to apply some penalty amount multipliers to the
total amount flowing over the channel. However, the commit updated the
docs for base_penalty_amount_multiplier_msat even though that behavior
didn't change. This commit reverts those docs.

4 weeks agoDon't over-penalize channels with inflight HTLCs
Jeffrey Czyz [Thu, 10 Oct 2024 23:01:23 +0000 (18:01 -0500)]
Don't over-penalize channels with inflight HTLCs

Commit df52da7b31494c7ec77a705cca4c44bc840f8a95 modified
ProbabilisticScorer to apply some penalty amount multipliers (e.g.,
liquidity_penalty_amount_multiplier_msat) to the total amount flowing
over the channel (i.e., including inflight HTLCs), not just the payment
in question. This led to over-penalizing in-use channels. Instead, only
apply the total amount when calculating success probability.

4 weeks agoMerge pull request #3359 from TheBlueMatt/2024-10-less-types-re-export
Gursharan Singh [Fri, 18 Oct 2024 21:35:49 +0000 (14:35 -0700)]
Merge pull request #3359 from TheBlueMatt/2024-10-less-types-re-export

Remove deprecated re-exports

4 weeks agoMerge pull request #3297 from TheBlueMatt/2024-09-cleanup-package
Matt Corallo [Fri, 18 Oct 2024 17:44:29 +0000 (17:44 +0000)]
Merge pull request #3297 from TheBlueMatt/2024-09-cleanup-package

Cleanup `PackageTemplate`a bit

4 weeks agoAdd a test for the fee-bump rate of timeout HTLC claims on cp txn 2024-09-cleanup-package
Matt Corallo [Fri, 18 Oct 2024 15:57:25 +0000 (15:57 +0000)]
Add a test for the fee-bump rate of timeout HTLC claims on cp txn

In a previous commit we updated the fee-bump-rate of claims against
HTLC timeouts on counterparty commitment transactions so that
instead of immediately attempting to bump every block we consider
the fact that we actually have at least `MIN_CLTV_EXPIRY_DELTA`
blocks to do so, and bumping at the appropriate rate given that.

Here we test that by adding an extra check to an existing test
that we do not bump in the very next block after the HTLC timeout
claim was initially broadcasted.

4 weeks agoSet correct `counterparty_spendable_height` for outb local HTLCs
Matt Corallo [Wed, 18 Sep 2024 18:20:46 +0000 (18:20 +0000)]
Set correct `counterparty_spendable_height` for outb local HTLCs

For outbound HTLCs, the counterparty can spend the output
immediately. This fixes the `counterparty_spendable_height` in the
`PackageTemplate` claiming outbound HTLCs on local commitment
transactions, which was previously spuriously set to the HTLC
timeout (at which point *we* can claim the HTLC).

5 weeks agoStop exporting `lightning::ln::features` 2024-10-less-types-re-export
Matt Corallo [Thu, 17 Oct 2024 19:38:19 +0000 (19:38 +0000)]
Stop exporting `lightning::ln::features`

Now that the module only contains some implementations of
serialization for the `lightning_types::features` structs, there's
no reason for it to be public.

5 weeks agoAdd a test of gossip message buffer limiting in `PeerManager` 2024-06-robust-updates
Matt Corallo [Tue, 20 Aug 2024 02:22:22 +0000 (02:22 +0000)]
Add a test of gossip message buffer limiting in `PeerManager`

This adds a simple test that the gossip message buffer in
`PeerManager` is limited, including the new behavior of bypassing
the limit when the broadcast comes from the
`ChannelMessageHandler`.

5 weeks agoAdd a constructor for the test `SocketDescriptor` and `hang_writes`
Matt Corallo [Tue, 20 Aug 2024 01:57:06 +0000 (01:57 +0000)]
Add a constructor for the test `SocketDescriptor` and `hang_writes`

In testing, its useful to be able to tell the `SocketDescriptor` to
pretend the system network buffer is full, which we add here by
creating a new `hang_writes` flag. In order to simplify
constructing, we also add a new constructor which existing tests
are moved to.

5 weeks agoFix the `establish_connection` utility method for a 2nd connection
Matt Corallo [Tue, 20 Aug 2024 02:13:55 +0000 (02:13 +0000)]
Fix the `establish_connection` utility method for a 2nd connection

The `establish_connection` method should work for more than one
connection per `PeerManager`, which we fix here.

5 weeks agoReliably deliver gossip messages from our `ChannelMessageHandler`
Matt Corallo [Mon, 24 Jun 2024 20:24:36 +0000 (20:24 +0000)]
Reliably deliver gossip messages from our `ChannelMessageHandler`

When our `ChannelMessageHandler` creates gossip broadcast
`MessageSendEvent`s, we generally want these to be reliably
delivered to all our peers, even if there's not much buffer space
available.

Here we do this by passing an extra flag to `forward_broadcast_msg`
which indicates where the message came from, then ignoring the
buffer-full criteria when the flag is set.

5 weeks agoRename `soonest_conf_deadline` to `counterparty_spendable_height`
Matt Corallo [Wed, 18 Sep 2024 16:48:24 +0000 (16:48 +0000)]
Rename `soonest_conf_deadline` to `counterparty_spendable_height`

This renames the field in `PackageTemplate` which describes the
height at which a counterparty can make a claim to an output to
match its actual use.

Previously it had been set based on when a counterparty can claim
an output but also used for other purposes. In the previous commit
we cleaned up its use for fee-bumping-rate, so here we can rename
it as it is now only used as the `counteraprty_spendable_height`.

5 weeks agoClean up `PackageTemplate::get_height_timer` to consider type
Matt Corallo [Wed, 18 Sep 2024 16:00:20 +0000 (16:00 +0000)]
Clean up `PackageTemplate::get_height_timer` to consider type

`PackageTemplate::get_height_timer` is used to decide when to next
bump our feerate on claims which need to make it on chain within
some window. It does so by comparing the current height with some
deadline and increasing the bump rate as the deadline approaches.

However, the deadline used is the `counterparty_spendable_height`,
which is the height at which the counterparty might be able to
spend the same output, irrespective of why. This doesn't make sense
for all output types, for example outbound HTLCs are spendable by
our counteraprty immediately (by revealing the preimage), but we
don't need to get our HTLC timeout claims confirmed immedaitely,
as we actually have `MIN_CLTV_EXPIRY` blocks before the inbound
edge of a forwarded HTLC becomes claimable by our (other)
counterparty.

Thus, here, we adapt `get_height_timer` to look at the type of
output being claimed, and adjust the rate at which we bump the fee
according to the real deadline.

5 weeks agoStop passing current height to `PackageTemplate::build_package`
Matt Corallo [Fri, 6 Sep 2024 00:33:45 +0000 (00:33 +0000)]
Stop passing current height to `PackageTemplate::build_package`

Now that we don't store the confirmation height of the inputs
being spent, passing the current height to
`PackageTemplate::build_package` is useless - we only use it to set
the height at which we should next bump the fee, but we just want
it to be "next block", so we might as well use `0` and avoid the
extra argument. Further, in one case we were already passing `0`,
so passing the argument is just confusing as we can't rely on it
being set.

Note that this does remove an assertion that we never merge
packages that were crated at different heights, and in the future
we may wish to do that (as there's no specific reason not to), but
we do not currently change the behavior.

5 weeks agoDrop unused `PackageTemplate::height_original`
Matt Corallo [Thu, 5 Sep 2024 23:48:02 +0000 (23:48 +0000)]
Drop unused `PackageTemplate::height_original`

This has never been used, and its set to a fixed value of zero for
HTLCs on local commitment transactions making it impossible to rely
on so might as well remove it.

5 weeks agoMerge pull request #3330 from tnull/2024-09-add-macros-crate
Matt Corallo [Thu, 17 Oct 2024 15:34:18 +0000 (15:34 +0000)]
Merge pull request #3330 from tnull/2024-09-add-macros-crate

Add `lightning-macros` crate and drop `bdk_macros` dependency

5 weeks agoMerge pull request #3371 from tnull/2024-10-allow-to-set-payment-and-description...
Matt Corallo [Thu, 17 Oct 2024 15:33:22 +0000 (15:33 +0000)]
Merge pull request #3371 from tnull/2024-10-allow-to-set-payment-and-description-hash

Invoice utils: allow to set both description hash and payment hash

5 weeks agoUpdate `lightning-transaction-sync` to use macros crate
Elias Rohrer [Sat, 21 Sep 2024 05:21:39 +0000 (14:21 +0900)]
Update `lightning-transaction-sync` to use macros crate

5 weeks agoAdd `lightning-macros` crate
Elias Rohrer [Sat, 21 Sep 2024 04:51:21 +0000 (13:51 +0900)]
Add `lightning-macros` crate

Previously, we used the `bdk_macros` dependency for some simple proc
macros in `lightning-transaction-sync`. However, post-1.0 BDK doesn't
further maintain this crate and will at some point probably yank it
together with the old `bdk` crate that was split up.

Here, we create a new crate for utility proc macros and ~~steal~~ add
what we currently use (slightly modified for the latest `syn` version's
API though). In the future we may want to expand this crate, e.g., for
some `maybe_async` macros in the context of an `async KVStore`
implementation.

5 weeks agoRename `PackageTemplate::timelock` `counteraprty_spendable_height`
Matt Corallo [Fri, 6 Sep 2024 00:25:00 +0000 (00:25 +0000)]
Rename `PackageTemplate::timelock` `counteraprty_spendable_height`

This function was very confusing - its used to determine by when
we have to stop aggregating this claim with others as it starts to
be at risk of pinning due to the counterparty's ability to spend
the output.

It is not ever used as a timelock for a transaction, and thus its
name is very confusing.

Instead we rename it `counterparty_spendable_height`.

5 weeks agoRename claim cleaning match bool for accuracy
Matt Corallo [Thu, 5 Sep 2024 21:06:16 +0000 (21:06 +0000)]
Rename claim cleaning match bool for accuracy

We don't actually care if a confirmed transaction claimed other
outputs, only that it claimed a superset of the outputs in the
pending claim we're looking at. Thus, the variable to detect that
is renamed `is_claim_subset_of_tx` instead of `are_sets_equal`.

5 weeks agoMerge pull request #3316 from optout21/signer_extend
Matt Corallo [Wed, 16 Oct 2024 18:43:09 +0000 (18:43 +0000)]
Merge pull request #3316 from optout21/signer_extend

[Splicing] Signer extended with method to sign prev funding transaction input

5 weeks agoInvoice utils: allow to set both description hash and payment hash
Elias Rohrer [Wed, 16 Oct 2024 15:04:38 +0000 (17:04 +0200)]
Invoice utils: allow to set both description hash and payment hash

5 weeks agoSigner extended with method to sign prev funding transaction input
optout [Tue, 15 Oct 2024 21:12:43 +0000 (23:12 +0200)]
Signer extended with method to sign prev funding transaction input

5 weeks agoMerge pull request #3329 from arik-so/monitor_archive_docs_followup
Gursharan Singh [Tue, 15 Oct 2024 20:54:46 +0000 (13:54 -0700)]
Merge pull request #3329 from arik-so/monitor_archive_docs_followup

Document monitor archival idempotency requirement (#3276 followup)

5 weeks agoDeprecate the `lightning::util::string` re-export from types
Matt Corallo [Sat, 12 Oct 2024 22:06:57 +0000 (22:06 +0000)]
Deprecate the `lightning::util::string` re-export from types

Like we've done for `features` and `payment`, here we mark the
`lightning::util::string` re-export as deprecated.

5 weeks agoDrop the `Payment{Hash,Preimage,Secret}` re-exports in `lightning`
Matt Corallo [Sat, 12 Oct 2024 21:59:54 +0000 (21:59 +0000)]
Drop the `Payment{Hash,Preimage,Secret}` re-exports in `lightning`

These re-exports were deprecated in 0.0.124 in favor of the
`lightning::types::payment::*` paths, which we use here.

5 weeks agoMerge pull request #3363 from G8XSU/event-logging-2
Elias Rohrer [Tue, 15 Oct 2024 07:32:37 +0000 (09:32 +0200)]
Merge pull request #3363 from G8XSU/event-logging-2

Revert "Add logging around event processing."

5 weeks agoMerge pull request #3366 from TheBlueMatt/2024-10-0.0.125-relnotes
Elias Rohrer [Tue, 15 Oct 2024 07:31:13 +0000 (09:31 +0200)]
Merge pull request #3366 from TheBlueMatt/2024-10-0.0.125-relnotes

Add CHANGELOG entry for 0.0.125

5 weeks agoAdd CHANGELOG entry for 0.0.125 2024-10-0.0.125-relnotes
Matt Corallo [Mon, 14 Oct 2024 17:28:25 +0000 (17:28 +0000)]
Add CHANGELOG entry for 0.0.125

5 weeks agoRevert "Add logging around event processing."
G8XSU [Mon, 16 Sep 2024 22:50:24 +0000 (15:50 -0700)]
Revert "Add logging around event processing."

This reverts commit 85eb8145fba1dbf3b9348d9142cc105ee13db33b.
Logging here can be overly verbose and moreover in case of event
handling failure, we loop back without any added delay.

5 weeks agoMerge pull request #3354 from tnull/2024-10-fix-block-init-synchronize
Matt Corallo [Mon, 14 Oct 2024 17:03:09 +0000 (17:03 +0000)]
Merge pull request #3354 from tnull/2024-10-fix-block-init-synchronize

`lightning-block-sync`: Fix `synchronize_listeners` always calling default implementation

5 weeks agoDrop `lightning::ln::features::*` type aliases
Matt Corallo [Sat, 12 Oct 2024 21:34:36 +0000 (21:34 +0000)]
Drop `lightning::ln::features::*` type aliases

These were deprecated in 0.0.124, and we drop them here in favor of
`lightning::types::features::*`.

5 weeks agoDocument monitor archival idempotency requirement.
Arik Sosman [Thu, 19 Sep 2024 16:30:49 +0000 (01:30 +0900)]
Document monitor archival idempotency requirement.

6 weeks agoMerge pull request #3349 from TheBlueMatt/2024-10-3270-followups
Matt Corallo [Fri, 11 Oct 2024 13:47:39 +0000 (13:47 +0000)]
Merge pull request #3349 from TheBlueMatt/2024-10-3270-followups

Minor #3270 Followups

6 weeks agoMerge pull request #3353 from tnull/2024-10-simplify-block-sync
Matt Corallo [Fri, 11 Oct 2024 13:45:53 +0000 (13:45 +0000)]
Merge pull request #3353 from tnull/2024-10-simplify-block-sync

Drop unnecessary `Result` in `RpcClient::new`

6 weeks agoFix `synchronize_listeners` calling default implementation
Elias Rohrer [Thu, 10 Oct 2024 15:16:18 +0000 (17:16 +0200)]
Fix `synchronize_listeners` calling default implementation

Previously, the `ChainListenerSet` `Listen` implementation wouldn't
forward to the listeners `block_connected` implementation outside of
tests. This would result in the default implementation of
`Listen::block_connected` being used and the listeners implementation
never being called.

6 weeks agoDrop unnecessary `Result` in `RestClient::new`
Elias Rohrer [Wed, 9 Oct 2024 17:35:42 +0000 (19:35 +0200)]
Drop unnecessary `Result` in `RestClient::new`

.. as it's infallible

6 weeks agoDrop unnecessary `Result` in `RpcClient::new`
Elias Rohrer [Wed, 9 Oct 2024 10:07:44 +0000 (12:07 +0200)]
Drop unnecessary `Result` in `RpcClient::new`

.. as it's infallible

6 weeks agoMerge pull request #3339 from arik-so/lint-script-file
Matt Corallo [Wed, 9 Oct 2024 14:09:13 +0000 (14:09 +0000)]
Merge pull request #3339 from arik-so/lint-script-file

Create script file for easy local linting

6 weeks agoCreate script file for easy local linting
Arik Sosman [Wed, 25 Sep 2024 02:21:19 +0000 (11:21 +0900)]
Create script file for easy local linting

6 weeks agoMerge pull request #3346 from TheBlueMatt/2024-10-dns-feature-flag
Matt Corallo [Tue, 8 Oct 2024 19:46:11 +0000 (19:46 +0000)]
Merge pull request #3346 from TheBlueMatt/2024-10-dns-feature-flag

Add support for parsing the dns_resolver feature bit

6 weeks agoMerge pull request #3235 from Mirebella/add-local-balance-msats
Matt Corallo [Tue, 8 Oct 2024 17:56:46 +0000 (17:56 +0000)]
Merge pull request #3235 from Mirebella/add-local-balance-msats

Add `last_local_balance_msats` field

6 weeks agoMerge pull request #3351 from carlaKC/arch-update-keys-interface
Matt Corallo [Tue, 8 Oct 2024 15:30:56 +0000 (15:30 +0000)]
Merge pull request #3351 from carlaKC/arch-update-keys-interface

docs/trivial: update diagram to reflect changes to KeysInterface

6 weeks agoAdd `Event::ChannelClosed::last_local_balance_msats`
Mirebella [Sun, 11 Aug 2024 15:50:45 +0000 (17:50 +0200)]
Add `Event::ChannelClosed::last_local_balance_msats`

Users commonly want to know what their balance was when a channel
was closed, which this provides in a somewhat simplified manner.

It does not consider pending HTLCs and will always overstate our
balance by transaction fees.

6 weeks agoarch: update diagram to reflect changes to KeysInterface
Carla Kirk-Cohen [Tue, 8 Oct 2024 13:17:47 +0000 (09:17 -0400)]
arch: update diagram to reflect changes to KeysInterface

KeysInterface was split into EntropySource, SignerProvider and
NodeSigner in #1930.

7 weeks agoHold a reference to byte arrays when serializing to bech32 2024-10-3270-followups
Matt Corallo [Thu, 3 Oct 2024 16:54:20 +0000 (16:54 +0000)]
Hold a reference to byte arrays when serializing to bech32

When we serialize from a byte array to bech32 in
`lightning-invoice`, we can either copy the array itself into the
iterator or hold a reference to the array and iterate through that.

In aa2f6b47df312f026213d0ceaaff20ffe955c377 we opted to copy the
array into the iterator, which is fine for the current array sizes
we're working with, but does result in additional memory on the
stack if, in the future, we end up writing large arrays.

Instead, here, we switch to using the slice serialization code when
writing arrays, (very marginally) reducing code size and reducing
stack usage.

7 weeks agoMarginally reduce allocations in `lightning-invoice`
Matt Corallo [Thu, 3 Oct 2024 16:54:14 +0000 (16:54 +0000)]
Marginally reduce allocations in `lightning-invoice`

In aa2f6b47df312f026213d0ceaaff20ffe955c377 we refactored
`lightning-invoice` de/serialization to use the new version of
`bech32`, but in order to keep the public API the same we
introduced one allocation we could have skipped.

Instead, here, we replace the public `Utf8Error` with
`FromUtf8Error` which contains the original data which failed
conversion, removing an allocation in the process.

7 weeks agoCheck that the HRPs generated in BOLT 11 `RawHrp` are always valid
Matt Corallo [Thu, 3 Oct 2024 16:54:10 +0000 (16:54 +0000)]
Check that the HRPs generated in BOLT 11 `RawHrp` are always valid

...in `debug_assertions`.

7 weeks agoDrop one unnecessary allocation added in aa2f6b47df312f026213d0ceaa
Matt Corallo [Thu, 3 Oct 2024 16:54:03 +0000 (16:54 +0000)]
Drop one unnecessary allocation added in aa2f6b47df312f026213d0ceaa

In aa2f6b47df312f026213d0ceaaff20ffe955c377 we refactored
`lightning-invoice` de/serialization to use the new version of
`bech32`, but ended up adding one unnecessary allocation in our
offers logic, which we drop here.

7 weeks agoMarginally reduce allocations in `lightning-invoice`
Matt Corallo [Thu, 3 Oct 2024 16:53:56 +0000 (16:53 +0000)]
Marginally reduce allocations in `lightning-invoice`

In aa2f6b47df312f026213d0ceaaff20ffe955c377 we refactored
`lightning-invoice` de/serialization to use the new version of
`bech32`, also reducing some trivial unnecessary allocations when
we did so.

Here we drop a few additional allocations which came up in review.

7 weeks agoMerge pull request #3270 from optout21/bech32-iterser
Matt Corallo [Thu, 3 Oct 2024 17:02:55 +0000 (17:02 +0000)]
Merge pull request #3270 from optout21/bech32-iterser

Upgrade bech32 dependency (iterative)

7 weeks agoUpgrade bech32 dependency, bech32 serialization improvements
optout [Wed, 2 Oct 2024 19:21:07 +0000 (21:21 +0200)]
Upgrade bech32 dependency, bech32 serialization improvements

7 weeks agoAllow a `DNSResolverMessageHandler` to set `dns_resolver` feature 2024-10-dns-feature-flag
Matt Corallo [Wed, 2 Oct 2024 18:21:33 +0000 (18:21 +0000)]
Allow a `DNSResolverMessageHandler` to set `dns_resolver` feature

A `DNSResolverMessageHandler` which handles resolution requests
should want the `NodeFeatures` included in the node's
`node_announcement` to include `dns_resolver` to indicate to the
world that it provides that service. Here we enable this by
requesting extra feature flags from the `DNSResolverMessageHandler`
in the features `OnionMessenger`, in turn, provides to
`PeerManager` (which builds the `node_announcement`).

7 weeks agoAdd support for parsing the `dns_resolver` feature bit
Matt Corallo [Wed, 2 Oct 2024 18:12:38 +0000 (18:12 +0000)]
Add support for parsing the `dns_resolver` feature bit

This feature bit is used to indicate that a node will make DNS
queries on behalf of onion message senders, returning DNSSEC TXT
proofs for the requested names.

It is used to signal support for bLIP 32 resolution and can be used
to find nodes from which we can try to resolve BIP 32 HRNs.

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

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

7 weeks agoAdd Bolt11InvoiceFeatures serialization tests
optout [Wed, 11 Sep 2024 20:32:27 +0000 (22:32 +0200)]
Add Bolt11InvoiceFeatures serialization tests

7 weeks 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#

7 weeks agoUse a `MessageSendEvent`-handling fn rather than a single lopp
Matt Corallo [Mon, 24 Jun 2024 20:21:08 +0000 (20:21 +0000)]
Use a `MessageSendEvent`-handling fn rather than a single lopp

Rather than building a single `Vec` of `MessageSendEvent`s to
handle then iterating over them, we move the body of the loop into
a lambda and run the loop twice. In some cases, this may save a
single allocation, but more importantly it sets us up for the next
commit, which needs to know from which handler the
`MessageSendEvent` it is processing came from.

7 weeks 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)

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

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

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

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