Commit graph

8128 commits

Author SHA1 Message Date
Matt Corallo
61a60d543c
Merge pull request #3402 from tnull/2024-11-pin-indexmap
Pin `indexmap` back to account for `hashbrown` MSRV bump
2024-11-07 22:12:19 +00:00
Matt Corallo
6bf218198f
Merge pull request #3399 from TheBlueMatt/2024-11-fuzz-assert
Drop broken debug assertion on peer buffer lengths
2024-11-07 21:43:12 +00:00
Matt Corallo
fcc59730a1
Merge pull request #3395 from mhrheaume/mhr/process_events_docs
Updated docs on `PeerManager::process_events`.
2024-11-07 17:54:03 +00:00
Elias Rohrer
e12ee9d120
Pin indexmap back to account for hashbrown MSRV bump
`indexmap` 2.6.0 upgraded to `hashbrown` 0.15, which unfortunately
bumped their MSRV to rustc 1.65 with the 0.15.1 release. So we pin
`indexmap` to 2.5.0 to fix our MSRV CI.
2024-11-07 14:35:12 +01:00
Elias Rohrer
c35adff51d
Merge pull request #3388 from TheBlueMatt/2024-10-counter-test
Add additional test coverage of `NetworkGraph` counters
2024-11-07 11:07:32 +01:00
Jeffrey Czyz
1e52c33c07
Merge pull request #3401 from tnull/2024-11-update-fuzz-readme
Update `fuzz` README to account for additional required `RUSTFLAGS`
2024-11-06 10:07:53 -06:00
Elias Rohrer
d13c2bd829
Update fuzz README to account for additional required RUSTFLAGS 2024-11-06 14:27:26 +01:00
Matthew Rheaume
9d071068a3 Updated docs on PeerManager::process_events.
Try to make it a bit more clear that there are downsides to solely
relying on `lightning-net-tokio`, and it's still recommended to
occasionally call this function in a separate loop.
2024-11-05 12:17:14 -08:00
Matt Corallo
8c086c772f
Merge pull request #3398 from vincenzopalazzo/macros/fixing-ci
ci: fixing the coverage report
2024-11-05 17:49:27 +00:00
Matt Corallo
d33284fafd
Merge pull request #3394 from tnull/2024-11-pin-idna-adapter
Pin `idna_adapter` to fix MSRV
2024-11-05 17:45:18 +00:00
Jeffrey Czyz
cb650a8606
Merge pull request #3237 from jkczyz/2024-08-offers-experimental-tlvs
Experimental offer TLVs
2024-11-05 11:37:02 -06:00
Matt Corallo
a29cf09417 Drop broken debug assertion on peer buffer lengths
1b711ed15f changed it so that we can
enqueue broadcast gossip messages to peers even though their buffer
is full as long as its our `ChannelMessageHandler` doing it. This
broke a debug assertion that the buffer isn't too large when
appending the broadcast message which is simply dropped here.

Found by the `full_stack_target` fuzzer.
2024-11-05 16:05:06 +00:00
Vincenzo Palazzo
f939d6a5ac
ci: fixing the coverage report
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2024-11-05 16:03:08 +01:00
Jeffrey Czyz
169b260493
Refactor tuple serialization into a macro 2024-11-04 18:00:24 -06:00
Jeffrey Czyz
76682409d4
Add parsing tests for experimental invoice TLVs 2024-11-04 18:00:24 -06:00
Jeffrey Czyz
8e279f719d
Parse experimental invoice TLV records
The BOLT12 spec defines an experimental TLV range that is allowed in
offer and invoice_request messages. The remaining TLV-space is for
experimental use in invoice messages. Allow this range when parsing an
invoice and include it when signing one.
2024-11-04 18:00:24 -06:00
Jeffrey Czyz
22d30e6b83
Add parsing tests for experimental refund TLVs 2024-11-04 18:00:24 -06:00
Jeffrey Czyz
9cf178f28f
Add parsing tests for experimental invreq TLVs 2024-11-04 18:00:23 -06:00
Jeffrey Czyz
e217c62863
Test verification with experimental invreq TLVs
Payer metadata is generated from the invreq TLVs and should included
those in the experimental range. When verifying invoice messages, these
TLVs must be included. Modify the BOLT12 verification tests to cover
them.
2024-11-04 18:00:23 -06:00
Jeffrey Czyz
5590bc2fa8
Parse experimental invreq TLV records
The BOLT12 spec defines an experimental TLV range that are allowed in
invoice_request messages. Allow this range when parsing an invoice
request and include those bytes in any invoice. Also include those bytes
when verifying that a Bolt12Invoice is for a valid InvoiceRequest.
2024-11-04 18:00:23 -06:00
Jeffrey Czyz
62cddb7d3a
Add offer test vectors for experimental TLVs 2024-11-04 18:00:23 -06:00
Jeffrey Czyz
a728d1dc2f
Add parsing tests for experimental offer TLVs 2024-11-04 18:00:23 -06:00
Jeffrey Czyz
6a708e2d9f
Test verification with experimental offer TLVs
Offer metadata is generated from the offer TLVs and should included
those in the experimental range. When verifying invoice request and
invoice messages, these TLVs must be included. Similarly, OfferId
construction should included these TLVs as well. Modify the BOLT12
verification tests to cover these TLVs.
2024-11-04 18:00:23 -06:00
Jeffrey Czyz
e01e731ff7
Parse experimental offer TLV records
The BOLT12 spec defines an experimental TLV range that are allowed in
offer messages. Allow this range when parsing an offer and include those
bytes in any invoice requests. Also include those bytes when computing
an OfferId and verifying that an InvoiceRequest is for a valid Offer.
2024-11-04 18:00:23 -06:00
Jeffrey Czyz
38e9457d97
Remove unnecessary destructure 2024-11-04 18:00:22 -06:00
Jeffrey Czyz
bcc7c1dc1d
Include experimental TLV records when verifying
Upcoming commits will allow parsing BOLT12 messages that include TLV
records in the experimental range. Include these ranges when verifying
messages since they will be included in the message bytes.
2024-11-04 18:00:22 -06:00
Jeffrey Czyz
63c687f0d9
Pass bytes instead of TlvStream to verify
Passing bytes directly to InvoiceContents::verify improves readability
as then a TlvStream for each TLV record range can be created from the
bytes instead of needing to clone the TlvStream upfront. In an upcoming
commit, the experimental TLV record range will utilize this.
2024-11-04 18:00:22 -06:00
Jeffrey Czyz
1eb5baa00c
Function for iterating over Offer TLV records
Add a utility function for iterating over Offer TLV records contained in
any valid TLV stream bytes. Using a common function ensures that
experimental TLV records are included once they are supported.
2024-11-04 18:00:22 -06:00
Jeffrey Czyz
771aa8ee24
Separate bytes for experimental TLVs
When constructing UnsignedInvoiceRequest or UnsignedBolt12Invoice, use a
separate field for experimental TLV bytes. This allows for properly
inserting the signature TLVs before the experimental TLVs when signing.
2024-11-04 18:00:15 -06:00
Elias Rohrer
8a8e0f7c8a
f Move pin to right place 2024-11-04 18:10:20 +01:00
valentinewallace
76a93a334b
Merge pull request #3360 from TheBlueMatt/2024-10-rebroadcast-chan-announcements
Re-broadcast `channel_announcement`s every six blocks for a week
2024-11-04 11:11:43 -05:00
Elias Rohrer
038b2812f9
Pin idna_adapter to fix MSRV 2024-11-04 16:06:41 +01:00
Matt Corallo
a130bd69de
Merge pull request #3207 from valentinewallace/2024-07-invreq-in-onion
Include invoice requests in async payment onions
2024-11-01 14:52:03 +00:00
Jeffrey Czyz
ef0f35a7b1
Merge pull request #3393 from tnull/2024-11-drop-dead-code
Drop dead code from `provide_latest_counterparty_commitment_tx`
2024-11-01 09:48:23 -05:00
Elias Rohrer
468588f2ff
Drop dead code from provide_latest_counterparty_commitment_tx
We drop some dead code that unnecessarily allocates a `Vec` but does
nothing else.
2024-11-01 10:26:46 +01:00
Valentine Wallace
240dd0a960
Fix outdated comment on PendingOutboundPayment::StaticInvoiceReceived 2024-10-30 16:18:03 -04:00
Valentine Wallace
34e710edd1
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.
2024-10-30 16:17:59 -04:00
Valentine Wallace
d574de95f5
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.
2024-10-30 16:17:57 -04:00
Valentine Wallace
925a0cb38b
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.
2024-10-30 16:17:55 -04:00
Valentine Wallace
520ae0b1f4
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.
2024-10-30 16:17:51 -04:00
Valentine Wallace
fead88faed
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.
2024-10-30 16:17:41 -04:00
Valentine Wallace
6a424536ac
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.
2024-10-30 16:17:32 -04:00
Valentine Wallace
9b3e30707e
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.
2024-10-30 16:17:20 -04:00
Valentine Wallace
a80af56af7
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.
2024-10-30 16:17:12 -04:00
Valentine Wallace
639446ad63
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.
2024-10-30 16:14:03 -04:00
Valentine Wallace
2ff6524da4
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.
2024-10-30 16:14:03 -04:00
Valentine Wallace
88d689a323
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.
2024-10-30 16:13:59 -04:00
Valentine Wallace
3945bf86f9
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..
2024-10-30 16:13:56 -04:00
Jeffrey Czyz
e23f89ce43
Remove unneeded Eq and PartialEq derives
TlvRecord has a few fields, but comparing only the record_bytes is
sufficient for equality since the other fields are initialized from it.
Remove the Eq and PartialEq derives as they compare these other fields.
2024-10-29 18:31:43 -05:00
Jeffrey Czyz
a77300129c
Add optional lifetime to tlv_stream macro
Using the tlv_stream macro without a type needing a reference results in
a compilation error because of an unused lifetime parameter. To avoid
this, add an optional lifetime parameter to the macro. This allows for
experimental TLVs, which will be empty initially, and TLVs of entirely
primitive types.
2024-10-29 18:31:43 -05:00