]> git.bitcoin.ninja Git - rust-lightning/log
rust-lightning
5 months agoDrop unnecessary key derivation in route tests 2024-06-real-bench
Matt Corallo [Wed, 12 Jun 2024 14:06:54 +0000 (14:06 +0000)]
Drop unnecessary key derivation in route tests

In our route tests we need some "random" bytes for the router to
randomize amounts using. We generate this by building an actual
`KeysManager` and then deriving some random bytes using the
`EntropySource` trait. However, `get_route` (what we're normally
testing) doesn't actually use the random bytes, and even if it did,
using a `KeysManager` is just a fancy way of creating a constant,
so there's really no reason to do all the fancy crypto.

Instead, here, we change our routing tests and benchmarks to simply
use `[42; 32]` as the "random" bytes.

5 months agoPush the route benchmark results into a separate uninlined function
Matt Corallo [Sat, 9 Dec 2023 18:51:09 +0000 (18:51 +0000)]
Push the route benchmark results into a separate uninlined function

This ensures the route benchmarks themselves will appear with a
distinct callgraph, making router profiling somewhat easier.

5 months agoUse a real (probing-generated) scorer in benchmarks
Matt Corallo [Sun, 10 Dec 2023 18:23:17 +0000 (18:23 +0000)]
Use a real (probing-generated) scorer in benchmarks

Until now, our routing benchmarks used a synthetic scorer,
generated by scoring random paths to build up some history. This is
pretty far removed from real-world routing conditions, as
alternative paths generally have no scoring information and even
the paths we do take have only one or two past scoring results.

Instead, we fetch a static serialized scorer, generated using
minutely probes. This means future changes to the scorer's data may
be harder to benchmark, but makes for substantially more realistic
benchmarks for changes which don't impact the serialized state.

5 months agoMerge pull request #3072 from arik-so/arik/gossip-v2-parsing
Matt Corallo [Wed, 5 Jun 2024 21:39:21 +0000 (14:39 -0700)]
Merge pull request #3072 from arik-so/arik/gossip-v2-parsing

Reintroduce addresses to NodeAnnouncementInfo.

5 months agoMerge pull request #3095 from TheBlueMatt/2024-06-tx-sync-bindings-upstream
valentinewallace [Wed, 5 Jun 2024 20:16:33 +0000 (16:16 -0400)]
Merge pull request #3095 from TheBlueMatt/2024-06-tx-sync-bindings-upstream

Mark BDK types exported from transaction-sync as no-export

5 months agoReintroduce addresses to NodeAnnouncementInfo.
Arik Sosman [Thu, 9 May 2024 16:42:37 +0000 (09:42 -0700)]
Reintroduce addresses to NodeAnnouncementInfo.

5 months agoMark BDK types exported from transaction-sync as no-export 2024-06-tx-sync-bindings-upstream
Matt Corallo [Wed, 5 Jun 2024 13:38:56 +0000 (13:38 +0000)]
Mark BDK types exported from transaction-sync as no-export

5 months agoMerge pull request #3091 from TheBlueMatt/2024-06-channel_state_ser
Matt Corallo [Tue, 4 Jun 2024 23:31:34 +0000 (16:31 -0700)]
Merge pull request #3091 from TheBlueMatt/2024-06-channel_state_ser

Move serialization of `channel_state` fields to `channel_state.rs`

5 months agoMerge pull request #3081 from G8XSU/2024-05-08-claimable-persist-3049-outputs
Matt Corallo [Tue, 4 Jun 2024 21:02:41 +0000 (14:02 -0700)]
Merge pull request #3081 from G8XSU/2024-05-08-claimable-persist-3049-outputs

Watch all outputs irrespective of claimable outpoints

5 months agoFromat moved code in `channel_state.rs` 2024-06-channel_state_ser
Matt Corallo [Tue, 4 Jun 2024 19:10:06 +0000 (19:10 +0000)]
Fromat moved code in `channel_state.rs`

5 months agoMove serialization of `channel_state` fields to `channel_state.rs`
Matt Corallo [Tue, 4 Jun 2024 14:46:15 +0000 (14:46 +0000)]
Move serialization of `channel_state` fields to `channel_state.rs`

1f616c0058f77e074c429fa7fb8b2f4594cdb9ad moved a handful of structs
to the new `channel_state.rs` but forgot to move their
serialization logic with them, which is corrected here.

5 months agoMerge pull request #3060 from TheBlueMatt/2024-05-parallel-async-om-events
Matt Corallo [Tue, 4 Jun 2024 19:10:43 +0000 (12:10 -0700)]
Merge pull request #3060 from TheBlueMatt/2024-05-parallel-async-om-events

Add a parallel async event handler to OnionMessenger and pass it directly to BackgroundProcessor

5 months agoMerge pull request #3088 from alecchendev/2024-06-fc-no-disconnect
Matt Corallo [Tue, 4 Jun 2024 15:47:22 +0000 (08:47 -0700)]
Merge pull request #3088 from alecchendev/2024-06-fc-no-disconnect

Don't disconnect on manual force closes

5 months agoMerge pull request #3089 from TheBlueMatt/2024-06-channel_state-module
Elias Rohrer [Tue, 4 Jun 2024 14:28:39 +0000 (16:28 +0200)]
Merge pull request #3089 from TheBlueMatt/2024-06-channel_state-module

Move the public channel state API into a new module

5 months agoMove the public path for `channel_state` types to their new path 2024-06-channel_state-module
Matt Corallo [Tue, 4 Jun 2024 01:25:52 +0000 (01:25 +0000)]
Move the public path for `channel_state` types to their new path

5 months agoReformat `channel_state.rs` to match rustfmt requirements
Matt Corallo [Tue, 4 Jun 2024 01:13:40 +0000 (01:13 +0000)]
Reformat `channel_state.rs` to match rustfmt requirements

5 months agoMove the public channel state API into a new module
Matt Corallo [Tue, 4 Jun 2024 01:06:54 +0000 (01:06 +0000)]
Move the public channel state API into a new module

Our "what is the channel's current state" structs have slowly
grown to be rather nontrivial, and now include eight structs with
many fields. Thus, it makes sense to pull them out of
`ln::channelmanager` and into their own module.

This also makes things easier for the C bindings which don't
support `pub use` from a private module.

5 months agoMerge pull request #2965 from tnull/2024-03-impl-readable-writeable-offer-invoice...
Matt Corallo [Tue, 4 Jun 2024 14:19:42 +0000 (07:19 -0700)]
Merge pull request #2965 from tnull/2024-03-impl-readable-writeable-offer-invoice-refund

Implement `Readable` for `Offer` and `Refund`

5 months agoImplement `Readable` for `Refund`
Elias Rohrer [Mon, 25 Mar 2024 13:07:21 +0000 (14:07 +0100)]
Implement `Readable` for `Refund`

When storing `Refund`s, it's useful for them to implement LDK's
deserialization trait.

5 months agoImplement `Readable` for `Offer`
Elias Rohrer [Mon, 25 Mar 2024 13:04:57 +0000 (14:04 +0100)]
Implement `Readable` for `Offer`

When storing `Offer`s, it's useful for them to implement LDK's
deserialization trait.

5 months agoDon't disconnect on manual force closes
Alec Chen [Mon, 3 Jun 2024 22:03:46 +0000 (17:03 -0500)]
Don't disconnect on manual force closes

5 months agoMerge pull request #2889 from Sharmalm/2840
Arik [Mon, 3 Jun 2024 21:48:52 +0000 (14:48 -0700)]
Merge pull request #2889 from Sharmalm/2840

Allow for user-specified error message during force close channel

5 months agoWatch all outputs irrespective of claimable outpoints.
G8XSU [Fri, 31 May 2024 22:26:57 +0000 (15:26 -0700)]
Watch all outputs irrespective of claimable outpoints.

This removes dependency of watched_outputs from
per_commitment_claimable_outpoints, it is required since we will
no longer have direct access to per_commitment_claimable_outpoints
once we start publishing PersistClaimInfo as part of #3049.

5 months agoDrop `EventsProvider` bounds on `OnionMessageHandler`s 2024-05-parallel-async-om-events
Matt Corallo [Fri, 10 May 2024 21:28:50 +0000 (21:28 +0000)]
Drop `EventsProvider` bounds on `OnionMessageHandler`s

This never really made a lot of sense from an API perspective, but
was required to avoid handing the background processor an explicit
`OnionMessegner`, which we are now doing. Thus, we can simply drop
these bounds as unnecessary.

5 months agof fix imports in BP
Matt Corallo [Tue, 28 May 2024 15:24:59 +0000 (15:24 +0000)]
f fix imports in BP

5 months agoSwitch to using the `OnionMessenger` directly in BP
Matt Corallo [Fri, 10 May 2024 21:07:08 +0000 (21:07 +0000)]
Switch to using the `OnionMessenger` directly in BP

When `OnionMessenger` first developed a timer and events interface,
we accessed the `OnionMessenger` indirectly via the `PeerManager`.
While this is a fairly awkward interface, it avoided a large pile
of generics on the background processor interfaces. However, since
we now have an `AOnionMessenger` trait, this concern is no longer
significant. Further, because we now want to use the built-in
`OnionMessenger` async event processing method, we really need a
direct referene to the `OnionMessenger` in the background
processor, which we add here optionally.

5 months agoAdd a parallel async event handler to `OnionMessenger`
Matt Corallo [Fri, 10 May 2024 20:52:10 +0000 (20:52 +0000)]
Add a parallel async event handler to `OnionMessenger`

This adds an `OnionMessenger::process_pending_events_async`
mirroring the same in `ChannelManager`. However, unlike the one in
`ChannelManager`, this processes the events in parallel by spawning
all futures and using the new `MultiFuturePoller`.

Because `OnionMessenger` just generates a stream of messages to
store/fetch, we first process all the events to store new messages,
`await` them, then process all the events to fetch stored messages,
ensuring reordering shouldn't result in lost messages (unless we
race with a peer disconnection, which could happen anyway).

5 months agoStore `OnionMessenger` events in different `Vec`s
Matt Corallo [Mon, 3 Jun 2024 18:28:45 +0000 (18:28 +0000)]
Store `OnionMessenger` events in different `Vec`s

In the next commit, `OnionMessenger` events are handled in parallel
using rust async. When we do that, we'll want to handle
`OnionMessageIntercepted` events prior to
`OnionMessagePeerConnected` ones.

While we'd generally prefer to handle all events in the order they
were generated, if we want to handle them in parallel, we don't
want a `OnionMessageIntercepted` event to start being processed,
then handle an `OnionMessagePeerConnected` prior to the first
completing. This could cause us to store a freshly-intercepted
message for a peer in a DB that was just wiped because the peer
is now connected.

This does run the risk of processing a `OnionMessagePeerConnected`
event prior to an `OnionMessageIntercepted` event (because a peer
connected, then disconnected, then we received a message for that
peer all before any events were handled), that is somewhat less
likely and discarding a message in a rare race is better than
leaving a message lying around undelivered.

Thus, here, we store `OnionMessenger` events in separate `Vec`s
which we can pull from in message-type-order.

5 months agoMerge pull request #3057 from G8XSU/2024-05-08-claimable-persist-3049
Matt Corallo [Mon, 3 Jun 2024 16:24:57 +0000 (09:24 -0700)]
Merge pull request #3057 from G8XSU/2024-05-08-claimable-persist-3049

Minimize reads to counterparty_claimable_outpoints

5 months agoMerge pull request #2947 from tnull/2024-03-log-features-if-mismatch
dunxen [Mon, 3 Jun 2024 14:59:15 +0000 (16:59 +0200)]
Merge pull request #2947 from tnull/2024-03-log-features-if-mismatch

5 months agoMerge pull request #2996 from shaavan/issue2882.2
Matt Corallo [Fri, 31 May 2024 21:57:11 +0000 (14:57 -0700)]
Merge pull request #2996 from shaavan/issue2882.2

Allow responding asynchronously to OnionMessage

5 months agoMerge pull request #3063 from jirijakes/upgrade-bitcoin-031
Matt Corallo [Fri, 31 May 2024 21:18:23 +0000 (14:18 -0700)]
Merge pull request #3063 from jirijakes/upgrade-bitcoin-031

Upgrade rust-bitcoin dependency to 0.31

5 months agoMerge pull request #2931 from TheBlueMatt/2024-03-log-outbound-channels
Elias Rohrer [Fri, 31 May 2024 10:31:21 +0000 (12:31 +0200)]
Merge pull request #2931 from TheBlueMatt/2024-03-log-outbound-channels

Log available liquidity on each channel when starting routefinding

5 months agoMerge pull request #3084 from jkczyz/2024-05-onion-fields
Matt Corallo [Thu, 30 May 2024 20:01:40 +0000 (13:01 -0700)]
Merge pull request #3084 from jkczyz/2024-05-onion-fields

Include `RecipientOnionFields` in `Event::PaymentClaimed`

5 months agoMinimize reads to counterparty_claimable_outpoints
G8XSU [Wed, 15 May 2024 04:57:20 +0000 (21:57 -0700)]
Minimize reads to counterparty_claimable_outpoints

Reads related to current/previous commitment_tx should be explicit
and reads related to older commitment_txs should be minimized.

5 months agoLog available liquidity on each channel when starting routefinding 2024-03-log-outbound-channels
Matt Corallo [Tue, 12 Mar 2024 14:29:45 +0000 (14:29 +0000)]
Log available liquidity on each channel when starting routefinding

One of the most common first-steps in troubleshooting routefinding
issues is we ask for the local channel state to determine what the
available HTLC bounds are. While we log first-hop channel details
when we decline to use them, this doesn't tell us if we have
missing channels, and thus here we log all first-hop channels at
the start.

We also take this opportunity to log the limits that were violated
any time we log that we're not using a channel, rather than only
when its a first-hop.

5 months agoUpgrade rust-bitcoin to 0.31
Jiri Jakes [Sat, 11 May 2024 02:55:02 +0000 (10:55 +0800)]
Upgrade rust-bitcoin to 0.31

5 months agoIntroduce new tests for `ResponseInstruction::WithReplyPath`
shaavan [Fri, 24 May 2024 09:00:34 +0000 (14:30 +0530)]
Introduce new tests for `ResponseInstruction::WithReplyPath`

- The new tests check both successful and unsuccessful `reply_path`
  creation conditions.

5 months agoRefactor TestCustomMessageHandler
shaavan [Thu, 23 May 2024 06:10:12 +0000 (11:40 +0530)]
Refactor TestCustomMessageHandler

- Introduce a new struct for keeping expectations organized.
- Add a boolean field to track whether a response is expected,
  and hence whether a `reply_path` should be included with the response.
- Update Ping and Pong roles for bidirectional communication.
- Introduce panic for when there is no responder and we were expecting
  to include a `reply_path`.
- Refactor `handle_custom_message` code.

5 months agoRefactor: Rename Request & Response to Ping & Pong
shaavan [Thu, 23 May 2024 06:03:34 +0000 (11:33 +0530)]
Refactor: Rename Request & Response to Ping & Pong

1. These two variants will be modified in an upcoming commit
   to be each other's response.
2. The names are updated to better fit their new roles.

5 months agoIntroduce ResponseInstruction::WithReplyPath variant.
shaavan [Mon, 15 Apr 2024 10:55:03 +0000 (16:25 +0530)]
Introduce ResponseInstruction::WithReplyPath variant.

And expand handle_onion_message_response return Type

1. Introduce a new function in OnionMessenger to create blinded paths.
2. Use it in handle_onion_message_response to create a reply_path for
   the right variant and use it in onion_message.
3. Expand the return type of handle_onion_message_response to handle three cases:
1. Ok(None) in case of no response to be sent.
2. Ok(Some(SendSuccess) and Err(SendError) in case of successful and
    unsuccessful queueing up of response messages respectively.

This allows the user to get access to the Success/Failure status of the sending
of response and handle it accordingly.

5 months agoConvert handle_onion_message_response to a public function and add test coverage
shaavan [Mon, 15 Apr 2024 09:52:25 +0000 (15:22 +0530)]
Convert handle_onion_message_response to a public function and add test coverage

This commit modifies handle_onion_message_response to be accessible
publicly as handle_onion_message, enabling users to respond
asynchronously. Additionally, a new test is introduced to validate this
functionality.

5 months agoMerge pull request #3011 from jkczyz/2024-04-compact-blinded-path-creation
Matt Corallo [Wed, 29 May 2024 01:43:20 +0000 (18:43 -0700)]
Merge pull request #3011 from jkczyz/2024-04-compact-blinded-path-creation

Compact blinded path creation

5 months agoAdd missing copyright statement
Jeffrey Czyz [Thu, 23 May 2024 20:52:32 +0000 (15:52 -0500)]
Add missing copyright statement

5 months agoCompact introduction node test vector
Jeffrey Czyz [Mon, 22 Apr 2024 19:52:15 +0000 (14:52 -0500)]
Compact introduction node test vector

5 months agoCompact a BlindedPath's introduction node
Jeffrey Czyz [Wed, 10 Apr 2024 21:04:19 +0000 (16:04 -0500)]
Compact a BlindedPath's introduction node

Add a method to BlindedPath that given a network graph will compact the
IntroductionNode as the DirectedShortChannelId variant. Call this method
from DefaultMessageRouter so that Offer paths use the compact
representation (along with reply paths). This leaves payment paths in
Bolt12Invoice using the NodeId variant, as the compact representation
isn't as useful there.

5 months agoUnwrap reply_path in extract_invoice_request
Jeffrey Czyz [Wed, 10 Apr 2024 21:07:58 +0000 (16:07 -0500)]
Unwrap reply_path in extract_invoice_request

5 months agoPass ForwardNode when creating BlindedPath
Jeffrey Czyz [Thu, 9 May 2024 22:31:37 +0000 (17:31 -0500)]
Pass ForwardNode when creating BlindedPath

Instead of passing Vec<PublicKey> to MessageRouter::crate_blinded_path,
pass Vec<ForwardNode>. This way callers can include a short_channel_id
for a more compact BlindedPath encoding.

5 months agoSupport NextHop::ShortChannelId in BlindedPath
Jeffrey Czyz [Tue, 9 Apr 2024 21:14:29 +0000 (16:14 -0500)]
Support NextHop::ShortChannelId in BlindedPath

When sending an onion message to a blinded path, the short channel id
between hops isn't need in each hop's encrypted_payload since it is not
a payment. However, using the short channel id instead of the node id
gives a more compact representation. Update BlindedPath::new_for_message
to allow for this.

5 months agoMerge pull request #3006 from arik-so/arik/trampoline/2024-04-trampoline-onion-deseri...
valentinewallace [Tue, 28 May 2024 20:55:17 +0000 (16:55 -0400)]
Merge pull request #3006 from arik-so/arik/trampoline/2024-04-trampoline-onion-deserialization

Trampoline Onion Deserialization

5 months agoMerge pull request #3051 from TheBlueMatt/2024-04-2982-123-fix
Matt Corallo [Tue, 28 May 2024 17:47:23 +0000 (10:47 -0700)]
Merge pull request #3051 from TheBlueMatt/2024-04-2982-123-fix

Don't attempt to resume channels if we already exchanged funding

5 months agoDon't attempt to resume channels if we already exchanged funding 2024-04-2982-123-fix
Matt Corallo [Wed, 1 May 2024 14:32:47 +0000 (14:32 +0000)]
Don't attempt to resume channels if we already exchanged funding

ddf75afd16 introduced the ability to re-exchange our `ChannelOpen`
after a peer disconnects if we didn't complete funding on our end.
It did not implement nor consider what would happen if we
re-connected after we created our own funding transactions, and
currently it panics (and even if it did not it would replay the
`FundingTransactionGenerated` event to users).

While we'd very much like to replay the `open_channel` flow even
if we have already received an `accept_channel` and funded the
channel, we cannot as the peer will likely provide different key
material in their `accept_channel`, causing us to need a different
funding transaction.

Thus, here, we simply close channels which have been funded but not
yet signed when our peer disconnects.

5 months agof docs
Matt Corallo [Tue, 28 May 2024 15:21:38 +0000 (15:21 +0000)]
f docs

5 months agoCheck custom_tlvs in Event::PaymentClaimed
Jeffrey Czyz [Fri, 24 May 2024 21:44:04 +0000 (16:44 -0500)]
Check custom_tlvs in Event::PaymentClaimed

5 months agoPass ClaimAlongRouteArgs to claim_payment_along_route
Jeffrey Czyz [Fri, 24 May 2024 21:16:13 +0000 (16:16 -0500)]
Pass ClaimAlongRouteArgs to claim_payment_along_route

5 months agoPass ClaimAlongRouteArgs to do_claim_payment_along_route
Jeffrey Czyz [Fri, 24 May 2024 20:30:40 +0000 (15:30 -0500)]
Pass ClaimAlongRouteArgs to do_claim_payment_along_route

5 months agoInclude RecipientOnionFields in PaymentClaimed
Jeffrey Czyz [Fri, 24 May 2024 20:34:07 +0000 (15:34 -0500)]
Include RecipientOnionFields in PaymentClaimed

RecipientOnionFields are included in Event::PaymentClaimable, so
naturally they should be included in Event::PaymentClaimed, too.

5 months agoAdd RecipientOnionFields to ClaimingPayment
Jeffrey Czyz [Fri, 24 May 2024 16:44:11 +0000 (11:44 -0500)]
Add RecipientOnionFields to ClaimingPayment

This will be used to include the same field in Event::PaymentClaimed.

5 months agoUse HashMap::entry instead of HashMap::insert
Jeffrey Czyz [Fri, 24 May 2024 16:31:30 +0000 (11:31 -0500)]
Use HashMap::entry instead of HashMap::insert

This allows for obtaining the value without needing to re-look it up. An
upcoming commit will include RecipientOnionFields in the inserted value.
Having it available afterwards prevents needing to clone it.

5 months agoFormat HashMap::insert call
Jeffrey Czyz [Fri, 24 May 2024 15:54:26 +0000 (10:54 -0500)]
Format HashMap::insert call

5 months agoMerge pull request #3079 from jkczyz/2024-05-expects-quantity
Elias Rohrer [Thu, 23 May 2024 11:01:06 +0000 (13:01 +0200)]
Merge pull request #3079 from jkczyz/2024-05-expects-quantity

Add missing `Offer::expects_quantity` to tests

6 months agoAdd missing Offer::expects_quantity to tests
Jeffrey Czyz [Wed, 22 May 2024 19:20:43 +0000 (14:20 -0500)]
Add missing Offer::expects_quantity to tests

6 months agoMerge pull request #3038 from TheBlueMatt/2024-05-no-dir-with-on-side-offline
valentinewallace [Tue, 21 May 2024 15:05:30 +0000 (11:05 -0400)]
Merge pull request #3038 from TheBlueMatt/2024-05-no-dir-with-on-side-offline

Ignore partially-pruned channels during routing

6 months agoMerge pull request #3026 from valentinewallace/2024-04-limit-path-len
Matt Corallo [Tue, 21 May 2024 14:19:37 +0000 (07:19 -0700)]
Merge pull request #3026 from valentinewallace/2024-04-limit-path-len

Limit payment path length based on `payment_metadata`, custom TLVs, etc.

6 months agoMerge pull request #3073 from tnull/2024-05-bump-nits
Matt Corallo [Tue, 21 May 2024 13:08:35 +0000 (06:08 -0700)]
Merge pull request #3073 from tnull/2024-05-bump-nits

Fix minor nits in `BumpTransactionEventHandler`

6 months agoMerge pull request #3068 from toxeus/main
Elias Rohrer [Tue, 21 May 2024 10:18:53 +0000 (12:18 +0200)]
Merge pull request #3068 from toxeus/main

Re-export bitcoin crate

6 months agoTest Trampoline onion (de)serialization round trip.
Arik Sosman [Thu, 18 Apr 2024 06:16:11 +0000 (23:16 -0700)]
Test Trampoline onion (de)serialization round trip.

6 months agoMake Trampoline onion deserializable.
Arik Sosman [Thu, 18 Apr 2024 05:59:21 +0000 (22:59 -0700)]
Make Trampoline onion deserializable.

6 months agoAdd public util on RouteParameters for setting max path length.
Valentine Wallace [Mon, 13 May 2024 22:49:36 +0000 (15:49 -0700)]
Add public util on RouteParameters for setting max path length.

6 months agoTest routing payment parameters' max path length setting and usage.
Valentine Wallace [Wed, 24 Apr 2024 15:43:50 +0000 (11:43 -0400)]
Test routing payment parameters' max path length setting and usage.

6 months agooutbound_payment: set max path length in PaymentParameters.
Valentine Wallace [Mon, 15 Apr 2024 20:31:29 +0000 (16:31 -0400)]
outbound_payment: set max path length in PaymentParameters.

So the router knows how long the maximum payment path can be.

6 months agoTest utils: include payment_metadata in PassAlongPathArgs.
Valentine Wallace [Wed, 24 Apr 2024 15:14:47 +0000 (11:14 -0400)]
Test utils: include payment_metadata in PassAlongPathArgs.

6 months agoAbide by max path length param in router.
Valentine Wallace [Mon, 13 May 2024 19:03:30 +0000 (12:03 -0700)]
Abide by max path length param in router.

Also adds some testing by augmenting existing tests.

6 months agoAdd max path length knob to PaymentParameters.
Valentine Wallace [Fri, 10 Nov 2023 22:03:15 +0000 (17:03 -0500)]
Add max path length knob to PaymentParameters.

Will be used so the outbound_payment module can calculate the maximum path
length with knowledge of any custom TLVs or payment metadata present.

6 months agoMerge pull request #3069 from TheBlueMatt/2024-06-log-chan-count
Elias Rohrer [Mon, 20 May 2024 12:13:18 +0000 (14:13 +0200)]
Merge pull request #3069 from TheBlueMatt/2024-06-log-chan-count

Log how many nodes/channels we have synced when we try to route

6 months agoLog how many nodes/channels we have synced when we try to route 2024-06-log-chan-count
Matt Corallo [Sun, 19 May 2024 18:35:04 +0000 (18:35 +0000)]
Log how many nodes/channels we have synced when we try to route

A common issue in LN is not having fully synced the network graph
when we attempt to send a payment. This should be improved
substantially with gossip v1.5, but for now we should improve our
debugability by logging how many nodes we have in our graph when
we attempt to find a route.

6 months agoRe-export bitcoin crate
Filip Gospodinov [Fri, 17 May 2024 15:00:44 +0000 (17:00 +0200)]
Re-export bitcoin crate

For the same reason the `bitcoin` crate is re-exporting
the `secp256k1` crate the `lightning` crate should
re-export the `bitcoin` crate: to ease the burden on
calling code to maintain compatible `bitcoin` versions.

The `lightning` crate makes heavy use of types defined in
(or re-exported by) the `bitcoin` crate. Compilation will
fail if e.g. comparisons or `match` expressions are done with
types from `bitcoin` crate versions with a non-equal minor
version. This forces calling code to depend on a `bitcoin`
crate with a compatible version. This becomes a maintenance
nightmare once two or more crates, that use `bitcoin` types
in their public API, are used in calling code simultaneously.

6 months agoFix minor nits in `BumpTransactionEventHandler`
Elias Rohrer [Fri, 17 May 2024 07:04:30 +0000 (09:04 +0200)]
Fix minor nits in `BumpTransactionEventHandler`

6 months agoExtract onion_utils::build_onion_payloads_callback helper.
Valentine Wallace [Fri, 10 May 2024 21:31:51 +0000 (17:31 -0400)]
Extract onion_utils::build_onion_payloads_callback helper.

Will be useful when we want to calculate the total size of the payloads without
actually allocating for them.

6 months agoMerge pull request #3036 from TheBlueMatt/2024-05-filter-color
valentinewallace [Tue, 14 May 2024 23:23:30 +0000 (16:23 -0700)]
Merge pull request #3036 from TheBlueMatt/2024-05-filter-color

Provide more color in filter registration methods

6 months agoMake MAX_PATH_LENGTH_ESTIMATE const pub and expand doc comment.
Valentine Wallace [Fri, 10 Nov 2023 22:01:52 +0000 (17:01 -0500)]
Make MAX_PATH_LENGTH_ESTIMATE const pub and expand doc comment.

Will be used in the next commit when we make this configurable in
PaymentParameters.

6 months agoTestRouter: support checking only that route params are as expected.
Valentine Wallace [Wed, 24 Apr 2024 15:15:51 +0000 (11:15 -0400)]
TestRouter: support checking only that route params are as expected.

6 months agoRemove unnecessary RecipientOnionFields clone.
Valentine Wallace [Mon, 15 Apr 2024 18:30:01 +0000 (14:30 -0400)]
Remove unnecessary RecipientOnionFields clone.

Doable now that we take Vecs by reference in OutboundOnionPayload.

6 months agoOutboundOnionPayload: hold Vec fields as references.
Valentine Wallace [Mon, 15 Apr 2024 18:02:45 +0000 (14:02 -0400)]
OutboundOnionPayload: hold Vec fields as references.

Will be useful when we reuse this enum to calculate the maximum path length,
to avoid cloning the vecs.

6 months agoMerge pull request #3061 from TheBlueMatt/2024-05-bindings-upstream
valentinewallace [Tue, 14 May 2024 16:44:25 +0000 (09:44 -0700)]
Merge pull request #3061 from TheBlueMatt/2024-05-bindings-upstream

Minor bindings tweaks

6 months agoAllow any `Deref` to an `EntropySource` in `BlindedPath` building 2024-05-bindings-upstream
Matt Corallo [Mon, 13 May 2024 18:01:20 +0000 (18:01 +0000)]
Allow any `Deref` to an `EntropySource` in `BlindedPath` building

This matches our normal API semantics and allows, for example,
`Arc`s to `EntropySource`s.

6 months agoimpl `Clone` on various public (mostly BOLT12) types
Matt Corallo [Mon, 13 May 2024 14:36:01 +0000 (14:36 +0000)]
impl `Clone` on various public (mostly BOLT12) types

This is required for bindings as passing types from Rust to GC'd
languages can't map the concept of a type that has a lifetime of
the called function but instead needs to clone for safety.

6 months agoExpose `ChannelManager` offer constructors in bindings
Matt Corallo [Mon, 13 May 2024 14:35:34 +0000 (14:35 +0000)]
Expose `ChannelManager` offer constructors in bindings

6 months agoMark `io_extras` as no-bindings-export as its not for public use
Matt Corallo [Sun, 12 May 2024 00:26:19 +0000 (00:26 +0000)]
Mark `io_extras` as no-bindings-export as its not for public use

6 months agoMake `offers::Amount` `Copy` and export it in bindings
Matt Corallo [Sat, 11 May 2024 18:51:48 +0000 (18:51 +0000)]
Make `offers::Amount` `Copy` and export it in bindings

`Amount` is less than two pointers long, so there's no reason it
shouldn't be `Copy`. Further, because its an enum, bindings can't
map a reference to it in an `Option`. Thus, here, we simply make it
`Copy` and return it in `Option`s rather than a reference to it.

6 months agoUse prelude by universal import, rather than single import
Matt Corallo [Sat, 11 May 2024 15:55:36 +0000 (15:55 +0000)]
Use prelude by universal import, rather than single import

This avoids the bindings trying to figure out what a
`lightning::prelude::Vec` is rather than matching it as a `Vec`.

6 months agoExport `ChannelId` in bindings rather than `[u8; 32]`
Matt Corallo [Sat, 11 May 2024 16:16:12 +0000 (16:16 +0000)]
Export `ChannelId` in bindings rather than `[u8; 32]`

Now that `ChannelId` has useful constructors and methods we need
to start exposing it to bindings users rather than relying on using
`[u8; 32]`.

6 months agoSkip `BestBlock::new` in bindings as we already have one
Matt Corallo [Sat, 11 May 2024 16:10:56 +0000 (16:10 +0000)]
Skip `BestBlock::new` in bindings as we already have one

6 months agoMerge pull request #3058 from benthecarman/deref-empty-nod-id-lookup
Matt Corallo [Mon, 13 May 2024 13:09:31 +0000 (06:09 -0700)]
Merge pull request #3058 from benthecarman/deref-empty-nod-id-lookup

impl Deref for EmptyNodeIdLookUp

6 months agoMerge pull request #3059 from jkczyz/2024-05-drop-writeable-signer
Matt Corallo [Sat, 11 May 2024 12:57:28 +0000 (05:57 -0700)]
Merge pull request #3059 from jkczyz/2024-05-drop-writeable-signer

Remove `WriteableEcdsaChannelSigner` trait

6 months agoRemove WriteableEcdsaChannelSigner trait
Jeffrey Czyz [Fri, 10 May 2024 19:32:48 +0000 (14:32 -0500)]
Remove WriteableEcdsaChannelSigner trait

WriteableEcdsaChannelSigner is no longer needed now that
EcdsaChannelSigner isn't written in OnchainTxHandler.

6 months agoStop writing EcdsaChannelSigner
Jeffrey Czyz [Fri, 10 May 2024 18:58:41 +0000 (13:58 -0500)]
Stop writing EcdsaChannelSigner

EcdsaChannelSigner is no longer deserialized as of version 0.0.113 and
downgrades before version 0.0.113 are no longer supported as of version
0.0.119.

6 months agoAdd a utility to poll multiple futures simultaneously
Matt Corallo [Fri, 10 May 2024 20:49:30 +0000 (20:49 +0000)]
Add a utility to poll multiple futures simultaneously

If we have a handful of futures we want to make progress on
simultaneously we need some way to poll all of them in series,
which we add here in the form of `MultiFuturePoller`. Its probably
not as effecient as some of the options in the `futures` crate, but
it is very trivial and not that bad.

6 months agoCreate an `AOnionMessenger` trait similar to our other `AStruct`s
Matt Corallo [Fri, 10 May 2024 20:39:53 +0000 (20:39 +0000)]
Create an `AOnionMessenger` trait similar to our other `AStruct`s

This allows us to have a bound on any `OnionMessenger` without
having to create bounds for every bound in `OnionMessenger`.

6 months agoMerge pull request #2930 from jbesraa/Add-PaymentHash-to-Record
Matt Corallo [Fri, 10 May 2024 16:55:55 +0000 (09:55 -0700)]
Merge pull request #2930 from jbesraa/Add-PaymentHash-to-Record

Add `PaymentHash` to `Record`