]> git.bitcoin.ninja Git - rust-lightning/log
rust-lightning
3 months agoAdd a script to automatically `rustfmt` all required files
Matt Corallo [Mon, 5 Aug 2024 16:59:57 +0000 (16:59 +0000)]
Add a script to automatically `rustfmt` all required files

As we now require `rustfmt` pass on a subset of our files, its
helpful to have a script which will automatically format any
required files so that contributors don't need to think too hard
about it.

3 months agoMerge pull request #3019 from benthecarman/is-public
Matt Corallo [Mon, 5 Aug 2024 15:11:27 +0000 (15:11 +0000)]
Merge pull request #3019 from benthecarman/is-public

Add more information to OpenChannelRequest Event

3 months agoMerge pull request #3202 from jkczyz/2024-07-blinded-path-auth-follow-up
Matt Corallo [Mon, 5 Aug 2024 14:56:22 +0000 (14:56 +0000)]
Merge pull request #3202 from jkczyz/2024-07-blinded-path-auth-follow-up

Follow-ups to #3139

3 months agoMerge pull request #3216 from tnull/2024-08-pin-tokio-in-ci
dunxen [Fri, 2 Aug 2024 10:09:48 +0000 (12:09 +0200)]
Merge pull request #3216 from tnull/2024-08-pin-tokio-in-ci

Pin `tokio` in CI to fix MSRV

3 months agoPin `tokio` in CI to fix MSRV
Elias Rohrer [Thu, 1 Aug 2024 16:51:53 +0000 (11:51 -0500)]
Pin `tokio` in CI to fix MSRV

The recently released `tokio` 1.39 bumped their MSRV to rustc 1.70.
Here, we pin the `tokio` version to 1.38 for users that require to
maintain our MSRV of rustc 1.63.

3 months agoReplace use of OffersContext::Unknown with None
Jeffrey Czyz [Tue, 23 Jul 2024 23:24:43 +0000 (18:24 -0500)]
Replace use of OffersContext::Unknown with None

Now that ChannelManager uses a known OffersContext when creating blinded
paths, OffersContext::Unknown is no longer needed. Remove it and update
OffersMessageHandler to us an Option, which is more idiomatic for
signifying whether a message was delivered with or without an
OffersContext.

3 months agoInclude payment hash in Bolt12Invoice reply path
Jeffrey Czyz [Tue, 23 Jul 2024 18:49:37 +0000 (13:49 -0500)]
Include payment hash in Bolt12Invoice reply path

Instead of using OffersContext::Unknown for the Bolt12Invoice reply path
use OffersContext::InboundPayment to include the payment hash.
OffersContext::Unknown will be removed in another commit.

3 months agoInclude payment hash when logging invoice handling
Jeffrey Czyz [Wed, 3 Jul 2024 16:12:47 +0000 (11:12 -0500)]
Include payment hash when logging invoice handling

3 months agoInclude payment hash when logging InvoiceError
Jeffrey Czyz [Wed, 3 Jul 2024 16:02:08 +0000 (11:02 -0500)]
Include payment hash when logging InvoiceError

By including the payment hash from the invoice in an onion message's
reply path, it can be used when logging errors as additional context.

3 months agoUse BlindedPath::new_for_payment in fuzz tests
Jeffrey Czyz [Tue, 23 Jul 2024 20:40:32 +0000 (15:40 -0500)]
Use BlindedPath::new_for_payment in fuzz tests

When creating a Bolt12Invoice in fuzz tests, use
BlindedPath::new_for_payment instead of BlindedPath::new_for_message.
This way PaymentContext is used instead of MessageContext, as is more
realistic though should not affect the test. This allows us to remove
OffersContext::Unknown.

3 months agoUse different iv_bytes for blinded path metadata
Jeffrey Czyz [Tue, 23 Jul 2024 22:54:31 +0000 (17:54 -0500)]
Use different iv_bytes for blinded path metadata

Best practice is to use different IV bytes for different contexts.
Update Offer and Refund metadata computation to use different IV bytes
when the metadata is included in a blinded path. For invoice requests,
the metatdata will always be in the blinded path, so it remains the
same.

3 months agoDelay adding iv_bytes to MetadataMaterial::hmac
Jeffrey Czyz [Tue, 23 Jul 2024 18:36:39 +0000 (13:36 -0500)]
Delay adding iv_bytes to MetadataMaterial::hmac

In an upcoming commit, the iv_bytes used in MetadataMaterial will vary
depending on when whether a blinded path is included in the
corresponding message. Delay adding into MetadataMaterial::hmac as
otherwise the HmacEngine would need to be re-initialized using an
ExpandedKey, which won't be readily available.

3 months agoResult from Bolt12Invoice::verify_using_payer_data
Jeffrey Czyz [Tue, 23 Jul 2024 21:09:14 +0000 (16:09 -0500)]
Result from Bolt12Invoice::verify_using_payer_data

Use a Result return type instead of a bool when verifying a
Bolt12Invoice. This way ignoring the result will produce a compiler
warning.

3 months agoBolt12Invoice::is_for_refund_without_paths tests
Jeffrey Czyz [Mon, 22 Jul 2024 21:14:00 +0000 (16:14 -0500)]
Bolt12Invoice::is_for_refund_without_paths tests

3 months agoMerge pull request #3189 from tnull/2024-07-rustfmt-lightning-net-tokio
Elias Rohrer [Tue, 30 Jul 2024 14:32:44 +0000 (09:32 -0500)]
Merge pull request #3189 from tnull/2024-07-rustfmt-lightning-net-tokio

 `rustfmt`: Run on `lightning-net-tokio`

3 months agoMerge pull request #3171 from jkczyz/2024-07-propagate-error
Elias Rohrer [Tue, 30 Jul 2024 14:11:07 +0000 (09:11 -0500)]
Merge pull request #3171 from jkczyz/2024-07-propagate-error

Include routing failures in `Bolt12PaymentError`

3 months agoAdd more information to OpenChannelRequest Event
benthecarman [Thu, 25 Apr 2024 03:36:40 +0000 (22:36 -0500)]
Add more information to OpenChannelRequest Event

3 months agoMerge pull request #3203 from lexe-app/pr/description-as-inner
Elias Rohrer [Wed, 24 Jul 2024 07:55:49 +0000 (09:55 +0200)]
Merge pull request #3203 from lexe-app/pr/description-as-inner

lightning-invoice: Add `Description::as_inner`

3 months agolightning-invoice: Add `Description::as_inner`
Max Fang [Wed, 24 Jul 2024 00:11:10 +0000 (17:11 -0700)]
lightning-invoice: Add `Description::as_inner`

3 months agoMerge pull request #3196 from TheBlueMatt/2024-07-monitor-ordering
Elias Rohrer [Tue, 23 Jul 2024 08:16:00 +0000 (10:16 +0200)]
Merge pull request #3196 from TheBlueMatt/2024-07-monitor-ordering

Ensure `ChannelMonitorUpdate`s are ordered with full monitor writes

3 months agoMerge pull request #3199 from TheBlueMatt/2024-07-funding-check
Elias Rohrer [Tue, 23 Jul 2024 08:10:35 +0000 (10:10 +0200)]
Merge pull request #3199 from TheBlueMatt/2024-07-funding-check

Enforce segwit inputs for all "safe" funding transactions

3 months agoMerge pull request #3139 from jkczyz/2024-06-blinded-path-auth
Matt Corallo [Mon, 22 Jul 2024 21:31:28 +0000 (21:31 +0000)]
Merge pull request #3139 from jkczyz/2024-06-blinded-path-auth

Authenticate use of offer blinded paths

3 months agoMerge pull request #3197 from TheBlueMatt/2024-07-stupid-locked-connect
Matt Corallo [Mon, 22 Jul 2024 20:08:26 +0000 (20:08 +0000)]
Merge pull request #3197 from TheBlueMatt/2024-07-stupid-locked-connect

[block-sync] Don't hold client-cache lock while connecting

3 months agoEnforce segwit inputs for all "safe" funding transactions 2024-07-funding-check
Matt Corallo [Mon, 22 Jul 2024 20:03:41 +0000 (20:03 +0000)]
Enforce segwit inputs for all "safe" funding transactions

8403755a2a524beb9f6c8951f51dd60f7c54c912 introduced a separate path
for funding a channel without a full funding transaction, relying
on users to manually broadcast the funding tx. One of the major
things that makes this path less safe is that for other paths we're
supposed to validate that all inputs have witnesses, making the
funding transaction (likely) txid-non-malleable.

However, in one of several rewrites of that commit the funding tx
tests ended up getting elided in some call paths, which is fixed
here.

3 months agoAdd pending changelog for BOLT12 authentication
Jeffrey Czyz [Wed, 17 Jul 2024 20:38:15 +0000 (15:38 -0500)]
Add pending changelog for BOLT12 authentication

3 months agoRename Bolt12Invoice::verify
Jeffrey Czyz [Fri, 19 Jul 2024 16:17:51 +0000 (11:17 -0500)]
Rename Bolt12Invoice::verify

3 months agoElide nonce from payer metadata
Jeffrey Czyz [Mon, 15 Jul 2024 23:29:41 +0000 (18:29 -0500)]
Elide nonce from payer metadata

InvoiceRequest and Refund have payer_metadata which consists of an
encrypted payment id and a nonce used to derive its signing keys and
authenticate any corresponding invoices. Now that the blinded paths
include this data in their OffersContext, remove the nonce as it is now
redundant. Keep the encrypted payment id as some data is needed in the
payer metadata according to the spec. This saves space and prevents
de-anonymization attacks as along as the nonce isn't revealed.

3 months agoCorrect docs
Jeffrey Czyz [Fri, 19 Jul 2024 16:50:07 +0000 (11:50 -0500)]
Correct docs

3 months agoInclude OffersContext in Event::InvoiceReceived
Jeffrey Czyz [Mon, 15 Jul 2024 23:22:43 +0000 (18:22 -0500)]
Include OffersContext in Event::InvoiceReceived

When authenticating that an invoice is for a valid invoice request, the
payer metadata is needed. Some of this data will be removed in the next
commit and instead be included in the message context of the request's
reply path. Add this data to Event::InvoiceReceived so that asynchronous
invoice handling can verify properly.

3 months agoAuthenticate Bolt12Invoice using BlindedPath data
Jeffrey Czyz [Fri, 12 Jul 2024 23:16:44 +0000 (18:16 -0500)]
Authenticate Bolt12Invoice using BlindedPath data

When a Bolt12Invoice is handled with an OfferContext, use both the
containing payment_id and nonce to verify that it is for a pending
outbound payment. Previously, the nonce the payment_id were taken from
the payer_metadata and the latter was compared against the payment_id
in the OfferContext. The payer_metadata thus no longer needs to include
either when a blinded path is used. However, some payer_metadata will
still be needed as per the spec.

3 months agoAdd nonce to OffersContext::OutboundPayment
Jeffrey Czyz [Fri, 12 Jul 2024 21:59:22 +0000 (16:59 -0500)]
Add nonce to OffersContext::OutboundPayment

To authenticate that a Bolt12Invoice is for a valid InvoiceRequest or
Refund, include the nonce from the payer_metadata in the InvoiceRequest
reply path or Refund::paths, respectively. This can be used to prevent
de-anonymization attacks where an attacker sends invoices using
self-constructed paths to nodes near the blinded paths' introduction
nodes.

3 months agoAdd Bolt12Invoice::verify_using_payer_data
Jeffrey Czyz [Fri, 12 Jul 2024 17:16:23 +0000 (12:16 -0500)]
Add Bolt12Invoice::verify_using_payer_data

Invoices are authenticated by checking the payer metadata in the
corresponding invoice request or refund. For all invoices requests and
for refunds using blinded paths, this will be the encrypted payment id
and a 128-bit nonce. Allows checking the unencrypted payment id and
nonce explicitly instead of the payer metadata. This will be used by an
upcoming change that includes the payment id and nonce in the invoice
request's reply path and the refund's blinded paths instead of
completely in the payer metadata, which mitigates de-anonymization
attacks.

3 months agoPass Nonce directly to RefundBuilder
Jeffrey Czyz [Fri, 12 Jul 2024 22:26:30 +0000 (17:26 -0500)]
Pass Nonce directly to RefundBuilder

When using RefundBuilder::deriving_payer_id, the nonce generated needs
to be the same one included in any RefundBuilder::paths. This is because
the nonce is used along with the refund TLVs to derive a payer id and
will soon be used to authenticate any invoices.

3 months agoPass Nonce directly to InvoiceRequestBuilder
Jeffrey Czyz [Fri, 12 Jul 2024 16:14:18 +0000 (11:14 -0500)]
Pass Nonce directly to InvoiceRequestBuilder

When using InvoiceRequestBuilder::deriving_payer_id, the nonce generated
needs to be the same one included in any reply path. This is because the
nonce is used along with the invoice request TLVs to derive a payer id.
While this data is also included in the payer_metadata, including it in
the blinded path would allow reducing the amount of data needed there to
just enough to provide entropy (i.e., 16 bytes). This is more important
for Refund because it can be transmitted via a QR code. But using the
same payer_metadata structure for both InvoiceRequest and Refund would
be beneficial to avoid more code.

3 months agoAdd failure tests for offer message authentication
Jeffrey Czyz [Wed, 3 Jul 2024 23:09:25 +0000 (18:09 -0500)]
Add failure tests for offer message authentication

3 months agoDon't send InvoiceError on failed authentication
Jeffrey Czyz [Wed, 3 Jul 2024 15:50:02 +0000 (10:50 -0500)]
Don't send InvoiceError on failed authentication

When an invoice or invoice request cannot be authenticated from an
OffersContext, simply do not respond instead of sending an InvoiceError
message. According to BOLT4, messages sent over a blinded path not
intended for its use MUST be ignored.

3 months agoAuthenticate Bolt12Invoice using OfferContext
Jeffrey Czyz [Tue, 2 Jul 2024 22:27:39 +0000 (17:27 -0500)]
Authenticate Bolt12Invoice using OfferContext

When a Bolt12Invoice is handled with an OfferContext, use the
containing payment_id to verify that it is for a pending outbound
payment. Only invoices for refunds without any blinded paths can be
verified without an OfferContext.

3 months agoAdd docs to Metadata::without_keys
Jeffrey Czyz [Thu, 18 Jul 2024 22:53:39 +0000 (17:53 -0500)]
Add docs to Metadata::without_keys

3 months agoRename InvoiceRequest::verify
Jeffrey Czyz [Fri, 19 Jul 2024 14:56:11 +0000 (09:56 -0500)]
Rename InvoiceRequest::verify

3 months agoElide metadata from Offer with derived keys
Jeffrey Czyz [Thu, 20 Jun 2024 16:43:57 +0000 (11:43 -0500)]
Elide metadata from Offer with derived keys

When an Offer uses blinded paths, its metadata consists of a nonce used
to derive its signing keys. Now that the blinded paths contain this
nonce, elide the metadata as it is now redundant. This saves space and
also makes it impossible to derive the signing keys if an invoice
request is received with the incorrect nonce. The nonce shouldn't be
revealed in this case either to prevent de-anonymization attacks.

3 months agoAuthenticate InvoiceRequest using OfferContext
Jeffrey Czyz [Tue, 2 Jul 2024 21:55:59 +0000 (16:55 -0500)]
Authenticate InvoiceRequest using OfferContext

When an InvoiceRequest is handled with an OfferContext, use the
containing nonce to verify that it is for a valid Offer. Otherwise, fall
back to using Offer::metadata, which also contains the nonce. The latter
is useful for supporting offers without blinded paths or those created
prior to including an OffersContext in their blinded paths.

3 months agoAdd OffersContext::InvoiceRequest
Jeffrey Czyz [Wed, 3 Jul 2024 18:47:07 +0000 (13:47 -0500)]
Add OffersContext::InvoiceRequest

To authenticate that an InvoiceRequest is for a valid Offer, include the
nonce from the Offer::metadata in the Offer::paths. This can be used to
prevent de-anonymization attacks where an attacker sends requests using
self-constructed paths to nodes near the Offer::paths' introduction
nodes.

3 months agoFix OffersContext::Unknown docs
Jeffrey Czyz [Thu, 18 Jul 2024 22:34:51 +0000 (17:34 -0500)]
Fix OffersContext::Unknown docs

3 months agoFix grammar
Jeffrey Czyz [Thu, 18 Jul 2024 22:33:00 +0000 (17:33 -0500)]
Fix grammar

3 months agoExpand OffersContext::OutboundPayment docs
Jeffrey Czyz [Tue, 9 Jul 2024 18:41:42 +0000 (13:41 -0500)]
Expand OffersContext::OutboundPayment docs

3 months agoWrap docs at 100 characters
Jeffrey Czyz [Tue, 9 Jul 2024 18:34:14 +0000 (13:34 -0500)]
Wrap docs at 100 characters

3 months agoClean up MessageContext docs
Jeffrey Czyz [Tue, 9 Jul 2024 18:31:34 +0000 (13:31 -0500)]
Clean up MessageContext docs

3 months agoAssert and document valid Metadata states
Jeffrey Czyz [Thu, 11 Jul 2024 19:00:38 +0000 (14:00 -0500)]
Assert and document valid Metadata states

Metadata is an internal type used within Offer messages. For any
constructed message, Metadata::Bytes is always used. The other variants
are used during construction or verification time. Document this and
debug_assert!(false) accordingly.

3 months agoAdd InvoiceRequest::verify_using_recipient_data
Jeffrey Czyz [Thu, 20 Jun 2024 00:18:26 +0000 (19:18 -0500)]
Add InvoiceRequest::verify_using_recipient_data

Invoice requests are authenticated by checking the metadata in the
corresponding offer. For offers using blinded paths, this will simply be
a 128-bit nonce. Allows checking this nonce explicitly instead of the
metadata. This will be used by an upcoming change that includes the
nonce in the offer's blinded paths instead of the metadata, which
mitigate de-anonymization attacks.

3 months agoPass Nonce directly to OfferBuilder
Jeffrey Czyz [Wed, 19 Jun 2024 17:42:16 +0000 (12:42 -0500)]
Pass Nonce directly to OfferBuilder

When using OfferBuilder::deriving_signing_pubkey, the nonce generated
needs to be the same one included in any OfferBuilder::paths. This is
because the nonce is used along with the offer TLVs to derive a signing
pubkey and will soon be elided from the metadata entirely.

3 months agoMove Nonce to a separate offers sub-module
Jeffrey Czyz [Wed, 19 Jun 2024 16:51:53 +0000 (11:51 -0500)]
Move Nonce to a separate offers sub-module

Nonce is used when constructing Offer::metadata and will soon be need
when constructing BlindedPath for use in authentication. Move it to
separate module now that it is public and will be more widely used.

3 months agoReorder imports
Jeffrey Czyz [Wed, 19 Jun 2024 16:40:34 +0000 (11:40 -0500)]
Reorder imports

3 months agoChange Nonce visibility to pub
Jeffrey Czyz [Wed, 19 Jun 2024 16:29:20 +0000 (11:29 -0500)]
Change Nonce visibility to pub

A nonce is generated in OfferBuilder::deriving_signing_pubkey from an
EntropySource for use in Offer::metadata. The same nonce will need to be
included as recipient data in any blinded paths in the Offer. Increase
the visibility to allow for this.

3 months agoMerge pull request #3024 from jbesraa/funding-signed-event
Elias Rohrer [Mon, 22 Jul 2024 13:47:59 +0000 (15:47 +0200)]
Merge pull request #3024 from jbesraa/funding-signed-event

Funding signed event

3 months ago[block-sync] Don't hold client-cache lock while connecting 2024-07-stupid-locked-connect
Matt Corallo [Sun, 21 Jul 2024 23:29:19 +0000 (23:29 +0000)]
[block-sync] Don't hold client-cache lock while connecting

`lightning-block-sync`'s REST and RPC clients both hold a cache for
a connected client to avoid the extra connection round-trip on each
request. Because only one client can be using a connection at once,
the connection is `take()`n out of an `Option` behind a `Mutex` and
if there isn't one present, we call `HttpClient::connect` to build
a new one.

However, this full logic is completed in one statement, causing a
client-cache lock to be held during `HttpClient::connect`. This
can turn into quite a bit of contention when using these clients as
gossip verifiers as we can create many requests back-to-back during
startup.

I noticed this as my node during startup only seemed to be
saturating one core and managed to get a backtrace that showed
several threads being blocked on this mutex when hitting a Bitcoin
Core node over REST that is on the same LAN, but not the same
machine.

3 months agoEnsure `ChannelMonitorUpdate`s are ordered with full monitor writes 2024-07-monitor-ordering
Matt Corallo [Sat, 20 Jul 2024 22:57:09 +0000 (22:57 +0000)]
Ensure `ChannelMonitorUpdate`s are ordered with full monitor writes

When we update a channel, then while connecting a block persist a
full `ChannelMonitor` prior to persisting the
`ChannelMonitorUpdate`, users can end up seeing a full
`ChannelMonitor` with a given `latest_update_id` prior to seeing
the `ChannelMonitorUpdate` with the same `update_id`. This
could cause users to have a full `ChannelMonitor` on disk as well
as a `ChannelMonitorUpdate` which was already applied. While this
isn't an issue for the LDK-provided update-based `Persist`, its
somewhat surprising for users so we avoid it.

3 months agoAdd debug_assert!(false) for unreachable code
Jeffrey Czyz [Thu, 18 Jul 2024 15:24:09 +0000 (10:24 -0500)]
Add debug_assert!(false) for unreachable code

3 months agoRefactor send_payment_for_bolt12_invoice
Jeffrey Czyz [Thu, 11 Jul 2024 22:07:53 +0000 (17:07 -0500)]
Refactor send_payment_for_bolt12_invoice

The BOLT11 and BOLT12 outbound payment initiation code differ in that
the latter re-uses the retry path (i.e., find_route_and_send_payment).
The drawback of this is that Ok is returned even if there is an error
finding a route. Refactor send_payment_for_bolt12_invoice such that it
re-uses find_initial_route instead so that errors can be returned.

3 months agoMerge pull request #3152 from alecchendev/2024-06-async-commit-secret-raa
Matt Corallo [Thu, 18 Jul 2024 15:17:57 +0000 (15:17 +0000)]
Merge pull request #3152 from alecchendev/2024-06-async-commit-secret-raa

Handle fallible commitment secret

3 months agoMerge pull request #2995 from tnull/2024-04-fallible-event-handler
Matt Corallo [Thu, 18 Jul 2024 15:07:07 +0000 (15:07 +0000)]
Merge pull request #2995 from tnull/2024-04-fallible-event-handler

Make event handling fallible

3 months agoDocument `Failure Behavior and Persistence` for every event type
Elias Rohrer [Mon, 8 Jul 2024 13:43:18 +0000 (15:43 +0200)]
Document `Failure Behavior and Persistence` for every event type

3 months agoAdd simple test for event replaying
Elias Rohrer [Mon, 8 Jul 2024 12:51:03 +0000 (14:51 +0200)]
Add simple test for event replaying

3 months agoHandle fallible events in `OnionMessenger`
Elias Rohrer [Tue, 2 Jul 2024 10:04:33 +0000 (12:04 +0200)]
Handle fallible events in `OnionMessenger`

Previously, we would just fire-and-forget in `OnionMessenger`'s event
handling. Since we now introduced the possibility of event handling
failures, we here adapt the event handling logic to retain any
events which we failed to handle to have them replayed upon the next
invocation of `process_pending_events`/`process_pending_events_async`.

3 months agoMake event handling fallible
Elias Rohrer [Mon, 15 Apr 2024 08:35:52 +0000 (10:35 +0200)]
Make event handling fallible

Previously, we would require our users to handle all events
successfully inline or panic will trying to do so. If they would exit
the `EventHandler` any other way we'd forget about the event and
wouldn't replay them after restart.

Here, we implement fallible event handling, allowing the user to return
`Err(())` which signals to our event providers they should abort event
processing and replay any unhandled events later (i.e., in the next
invocation).

3 months agoRemove `lightning-net-tokio` from exclusion list
Elias Rohrer [Thu, 18 Jul 2024 08:05:46 +0000 (10:05 +0200)]
Remove `lightning-net-tokio` from exclusion list

3 months ago`rustfmt`: Run on `lightning-net-tokio`
Elias Rohrer [Thu, 18 Jul 2024 08:05:05 +0000 (10:05 +0200)]
`rustfmt`: Run on `lightning-net-tokio`

3 months agoPrepare `lightning-net-tokio/src/lib.rs`
Elias Rohrer [Thu, 18 Jul 2024 08:22:30 +0000 (10:22 +0200)]
Prepare `lightning-net-tokio/src/lib.rs`

3 months agoHold sep. Mutexes for pending `intercepted_msgs`/`peer_connected` events
Elias Rohrer [Tue, 2 Jul 2024 09:11:40 +0000 (11:11 +0200)]
Hold sep. Mutexes for pending `intercepted_msgs`/`peer_connected` events

This is a minor refactor that will allow us to access the individual
event queue Mutexes separately, allowing us to drop the locks earlier
when processing them individually.

3 months agoMerge pull request #3160 from TheBlueMatt/2024-07-better-enum-upgradable-ser
Matt Corallo [Wed, 17 Jul 2024 18:05:22 +0000 (18:05 +0000)]
Merge pull request #3160 from TheBlueMatt/2024-07-better-enum-upgradable-ser

Make `impl_writeable_tlv_based_enum*` actually upgradable

3 months agoTest fallible commitment secret
Alec Chen [Tue, 2 Jul 2024 01:33:25 +0000 (18:33 -0700)]
Test fallible commitment secret

3 months agoMerge pull request #3187 from TheBlueMatt/2024-07-routing-nits
Matt Corallo [Wed, 17 Jul 2024 17:12:00 +0000 (17:12 +0000)]
Merge pull request #3187 from TheBlueMatt/2024-07-routing-nits

#2803 nits

3 months agoMerge pull request #3136 from tnull/2024-06-rustfmt-lightning-block-sync
Matt Corallo [Wed, 17 Jul 2024 15:51:42 +0000 (15:51 +0000)]
Merge pull request #3136 from tnull/2024-06-rustfmt-lightning-block-sync

Run `rustfmt` on `lightning-block-sync`

3 months agoAdd pending changelog entry for the previous commit 2024-07-better-enum-upgradable-ser
Matt Corallo [Mon, 8 Jul 2024 20:43:51 +0000 (20:43 +0000)]
Add pending changelog entry for the previous commit

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

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

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

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

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

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

3 months agoDrop excess `()`s in `router.rs` 2024-07-routing-nits
Matt Corallo [Wed, 17 Jul 2024 14:08:50 +0000 (14:08 +0000)]
Drop excess `()`s in `router.rs`

3 months agoMarginally improve comments around cache lines in `gossip.rs`
Matt Corallo [Wed, 17 Jul 2024 14:08:39 +0000 (14:08 +0000)]
Marginally improve comments around cache lines in `gossip.rs`

3 months agoMerge pull request #2803 from TheBlueMatt/2023-12-routing-dist-vec
Matt Corallo [Wed, 17 Jul 2024 14:06:05 +0000 (14:06 +0000)]
Merge pull request #2803 from TheBlueMatt/2023-12-routing-dist-vec

Misc routing optimization

3 months agoHandle fallible `release_commitment_secret`
Alec Chen [Tue, 2 Jul 2024 01:13:49 +0000 (18:13 -0700)]
Handle fallible `release_commitment_secret`

3 months agoMerge pull request #3087 from shaavan/reply_path_diversity
Matt Corallo [Tue, 16 Jul 2024 19:29:08 +0000 (19:29 +0000)]
Merge pull request #3087 from shaavan/reply_path_diversity

Allow blinded path diversification by expanding `create_blinded_paths`

3 months agoMerge pull request #3185 from tnull/2024-07-clarify-max-description-length
Matt Corallo [Tue, 16 Jul 2024 15:24:45 +0000 (08:24 -0700)]
Merge pull request #3185 from tnull/2024-07-clarify-max-description-length

Clarify maximum length of an invoice description

3 months agoMerge pull request #3183 from TheBlueMatt/2024-07-no-strict
Matt Corallo [Tue, 16 Jul 2024 13:31:52 +0000 (06:31 -0700)]
Merge pull request #3183 from TheBlueMatt/2024-07-no-strict

Drop unnecessary `strict` feature from `lightning-invoice`

3 months agoMerge pull request #3150 from alecchendev/2024-06-async-commit-point-raa
Matt Corallo [Tue, 16 Jul 2024 13:30:57 +0000 (06:30 -0700)]
Merge pull request #3150 from alecchendev/2024-06-async-commit-point-raa

Handle fallible per commitment point for RAA

4 months agoClarify maximum length of an invoice description
Elias Rohrer [Tue, 16 Jul 2024 08:28:58 +0000 (10:28 +0200)]
Clarify maximum length of an invoice description

We previously stated in the docs that the invoice description can be at most `1023`
bytes long, which is wrong. According to BOLT 11 it's at most 1023*5 bits (639 bytes) long.

4 months agoTest async get per commitment point for revoke_and_ack
Alec Chen [Sun, 30 Jun 2024 23:05:48 +0000 (16:05 -0700)]
Test async get per commitment point for revoke_and_ack

Note: this does not test the CS -> RAA resend ordering, because this
requires handling async get_per_commitment_point for channel
reestablishment, which will be addressed in a follow up PR.

4 months agoAllow failing revoke_and_ack if commitment point is not available
Alec Chen [Sat, 29 Jun 2024 22:41:27 +0000 (15:41 -0700)]
Allow failing revoke_and_ack if commitment point is not available

4 months agoChange get_per_commitment_point to return result type
Alec Chen [Wed, 5 Jun 2024 22:40:38 +0000 (17:40 -0500)]
Change get_per_commitment_point to return result type

Includes simple changes to test util signers and tests, as well as
handling the error case for get_per_commitment_point in
HolderCommitmentPoint. This leaves a couple `.expect`s in places
that will be addressed in a separate PR for handling funding.

4 months agoMerge pull request #3165 from Harshit933/link-fix
Matt Corallo [Mon, 15 Jul 2024 19:17:09 +0000 (12:17 -0700)]
Merge pull request #3165 from Harshit933/link-fix

Fixes `Sensei` broken link

4 months agoAdd logger as parameter in creating ChannelContext
Alec Chen [Thu, 30 May 2024 20:25:29 +0000 (15:25 -0500)]
Add logger as parameter in creating ChannelContext

4 months agoReturn an error if we fail to advance our commitment number
Alec Chen [Tue, 18 Jun 2024 21:48:23 +0000 (14:48 -0700)]
Return an error if we fail to advance our commitment number

4 months agoDrop unnecessary `strict` feature from `lightning-invoice` 2024-07-no-strict
Matt Corallo [Mon, 15 Jul 2024 18:34:04 +0000 (18:34 +0000)]
Drop unnecessary `strict` feature from `lightning-invoice`

99aa6e27f616c96dda2b49d09bafbc0b982251e0 detected that we had an
undefined feature in `lightning-invoice` called `strict`, which was
used to turn on `deny(warnings)`. It resolved that by adding the
feature to the `Cargo.toml`, but we actually don't need it - our CI
already builds with `-Dwarnings`, so any warnings should be
rejected during CI and there's not a lot of value in having a
(public) feature to do the same.

4 months agoMerge pull request #3173 from dunxen/2024-07-cargocheckcfg
Matt Corallo [Mon, 15 Jul 2024 18:33:08 +0000 (11:33 -0700)]
Merge pull request #3173 from dunxen/2024-07-cargocheckcfg

Use native check-cfg lint in cargo beta

4 months agoSplit HolderCommitmentPoint::advance off into separate function
Alec Chen [Tue, 18 Jun 2024 21:26:25 +0000 (14:26 -0700)]
Split HolderCommitmentPoint::advance off into separate function

4 months agoMerge pull request #3180 from tnull/2024-07-use-upstreamed-merkle-validation
Matt Corallo [Mon, 15 Jul 2024 18:16:40 +0000 (11:16 -0700)]
Merge pull request #3180 from tnull/2024-07-use-upstreamed-merkle-validation

Electrum: Use upstreamed `validate_merkle_proof`

4 months agoMerge pull request #3172 from tnull/2024-07-revert-gossip-query-patch
valentinewallace [Mon, 15 Jul 2024 17:39:54 +0000 (13:39 -0400)]
Merge pull request #3172 from tnull/2024-07-revert-gossip-query-patch

Revert "Signal `GossipQuery` support when using `IgnoringMessagHandler`"

4 months agoUse upstreamed `validate_merkle_proof`
Elias Rohrer [Mon, 15 Jul 2024 11:43:22 +0000 (13:43 +0200)]
Use upstreamed `validate_merkle_proof`

We previously upstreamed the `validate_merkle_proof` utility method,
which shipped with `electrum-client` 0.19.0.

Since we upgraded to that version recently, we can now drop our local
code and use the upstreamed version.

4 months agoDrop `lightning-background-processor/src/lib.rs` from exclusion list
Elias Rohrer [Mon, 15 Jul 2024 11:55:48 +0000 (13:55 +0200)]
Drop `lightning-background-processor/src/lib.rs` from exclusion list

We previously forgot to drop it (or it snuck back in during rebasing),
so we drop `lightning-background-processor` from the rustfmt exclusion
list.

4 months ago`rustfmt`: Drop `lightning-custom-message/src/lib.rs` from excluded
Elias Rohrer [Thu, 20 Jun 2024 09:10:43 +0000 (11:10 +0200)]
`rustfmt`: Drop `lightning-custom-message/src/lib.rs` from excluded

.. files

4 months ago`rustfmt`: Run on `lightning-block-sync/src/lib.rs`
Elias Rohrer [Thu, 20 Jun 2024 09:10:11 +0000 (11:10 +0200)]
`rustfmt`: Run on `lightning-block-sync/src/lib.rs`

4 months ago`rustfmt`: Run on `lightning-block-sync/src/utils.rs`
Elias Rohrer [Thu, 20 Jun 2024 09:09:46 +0000 (11:09 +0200)]
`rustfmt`: Run on `lightning-block-sync/src/utils.rs`

4 months ago`rustfmt`: Run on `lightning-block-sync/src/test_utils.rs`
Elias Rohrer [Thu, 20 Jun 2024 09:09:15 +0000 (11:09 +0200)]
`rustfmt`: Run on `lightning-block-sync/src/test_utils.rs`