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.
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.
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
Valentine Wallace [Fri, 24 May 2024 16:15:53 +0000 (12:15 -0400)]
Remove now-unused NetworkUpdate::ChannelUpdateMessage.
See previous commit.
Jeffrey Czyz [Thu, 23 May 2024 20:52:32 +0000 (15:52 -0500)]
Add missing copyright statement
Jeffrey Czyz [Mon, 22 Apr 2024 19:52:15 +0000 (14:52 -0500)]
Compact introduction node test vector
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.
Jeffrey Czyz [Wed, 10 Apr 2024 21:07:58 +0000 (16:07 -0500)]
Unwrap reply_path in extract_invoice_request
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.
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.
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
Valentine Wallace [Tue, 28 May 2024 20:37:40 +0000 (16:37 -0400)]
Fix import order in gossip.rs.
A new import will be added in the next commit.
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
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.
Matt Corallo [Tue, 28 May 2024 15:21:38 +0000 (15:21 +0000)]
f docs
Jeffrey Czyz [Fri, 24 May 2024 21:44:04 +0000 (16:44 -0500)]
Check custom_tlvs in Event::PaymentClaimed
Jeffrey Czyz [Fri, 24 May 2024 21:16:13 +0000 (16:16 -0500)]
Pass ClaimAlongRouteArgs to 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
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.
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.
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.
Jeffrey Czyz [Fri, 24 May 2024 15:54:26 +0000 (10:54 -0500)]
Format HashMap::insert call
Valentine Wallace [Thu, 23 May 2024 21:00:10 +0000 (17:00 -0400)]
Ignore channel updates in onion errors.
Per <https://github.com/lightning/bolts/pull/1163>.
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
Jeffrey Czyz [Wed, 22 May 2024 19:20:43 +0000 (14:20 -0500)]
Add missing Offer::expects_quantity to tests
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
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.
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`
Elias Rohrer [Tue, 21 May 2024 10:18:53 +0000 (12:18 +0200)]
Merge pull request #3068 from toxeus/main
Re-export bitcoin crate
Arik Sosman [Thu, 18 Apr 2024 06:16:11 +0000 (23:16 -0700)]
Test Trampoline onion (de)serialization round trip.
Arik Sosman [Thu, 18 Apr 2024 05:59:21 +0000 (22:59 -0700)]
Make Trampoline onion deserializable.
Valentine Wallace [Mon, 13 May 2024 22:49:36 +0000 (15:49 -0700)]
Add public util on RouteParameters for setting max path length.
Valentine Wallace [Wed, 24 Apr 2024 15:43:50 +0000 (11:43 -0400)]
Test routing payment parameters' max path length setting and usage.
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.
Valentine Wallace [Wed, 24 Apr 2024 15:14:47 +0000 (11:14 -0400)]
Test utils: include payment_metadata in PassAlongPathArgs.
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.
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.
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
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.
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.
Elias Rohrer [Fri, 17 May 2024 07:04:30 +0000 (09:04 +0200)]
Fix minor nits in `BumpTransactionEventHandler`
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.
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
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.
Valentine Wallace [Wed, 24 Apr 2024 15:15:51 +0000 (11:15 -0400)]
TestRouter: support checking only that route params are as expected.
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.
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.
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
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.
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.
Matt Corallo [Mon, 13 May 2024 14:35:34 +0000 (14:35 +0000)]
Expose `ChannelManager` offer constructors in bindings
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
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.
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`.
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]`.
Matt Corallo [Sat, 11 May 2024 16:10:56 +0000 (16:10 +0000)]
Skip `BestBlock::new` in bindings as we already have one
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
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
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.
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.
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.
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`.
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`
Arik [Thu, 9 May 2024 22:27:49 +0000 (15:27 -0700)]
Merge pull request #2973 from valentinewallace/2024-03-om-mailbox
Support intercepting onion messages for offline peers
benthecarman [Thu, 9 May 2024 17:16:40 +0000 (12:16 -0500)]
impl Deref for EmptyNodeIdLookUp
Valentine Wallace [Wed, 27 Mar 2024 15:52:10 +0000 (11:52 -0400)]
Fill in top-level docs for onion message offline peer interception.
Valentine Wallace [Wed, 27 Mar 2024 14:09:47 +0000 (10:09 -0400)]
Limit OnionMessenger event buffer size.
Valentine Wallace [Wed, 27 Mar 2024 15:06:33 +0000 (11:06 -0400)]
Manually implement Debug for onion message packets.
Previously we derived Debug, but that caused a lot of unreadable encrypted
bytes to be printed.
Valentine Wallace [Wed, 27 Mar 2024 15:05:21 +0000 (11:05 -0400)]
Test offline peer onion message interception.
Valentine Wallace [Mon, 25 Mar 2024 17:23:00 +0000 (13:23 -0400)]
Fix outdated comment in onion message functional test.
Valentine Wallace [Mon, 25 Mar 2024 17:14:29 +0000 (13:14 -0400)]
Refactor MessengerNode test util construction to take config.
Will be used in the next commit when another config parameter is added.
Valentine Wallace [Mon, 25 Mar 2024 15:42:13 +0000 (11:42 -0400)]
Support forwarding prebuilt onion messages in OnionMessenger.
Valentine Wallace [Fri, 22 Mar 2024 19:58:33 +0000 (15:58 -0400)]
OnionMessenger: support generating peer connection events.
Useful if we are in the mode of interception OMs for offline peers, so
users know when to re-inject intercepted OMs.
Valentine Wallace [Thu, 21 Mar 2024 17:56:54 +0000 (13:56 -0400)]
Support generating events when an OM for an offline peer is received.
Docs will be added in upcoming commits.
Matt Corallo [Thu, 9 May 2024 16:47:41 +0000 (09:47 -0700)]
Merge pull request #3041 from G8XSU/followup-2957
Followups to #2957
Matt Corallo [Mon, 6 May 2024 01:23:56 +0000 (01:23 +0000)]
Ignore partially-pruned channels during routing
If we prune one side of a channel's `ChannelUpdateInfo` that means
the node hasn't been online for two weeks (as they haven't
generated a new `channel_update` in that time). In such cases, even
if we haven't yet pruned the channel entirely, we should definitely
not be treating these channels as candidates for routing.
Note that this requires some additional `channel_update`s in the
router tests, but all of the new ones are added as disabled
channels.
Fixes #1824
jbesraa [Sun, 24 Mar 2024 05:07:09 +0000 (07:07 +0200)]
Add `payment_hash` to `WithChannelMonitor`
esraa [Tue, 12 Mar 2024 14:23:00 +0000 (14:23 +0000)]
Add `PaymentHash` to `Record`
Adding the `payment_hash` to `Record` so we are able to track it
in logs.
Jeffrey Czyz [Wed, 8 May 2024 22:32:41 +0000 (17:32 -0500)]
Merge pull request #2907 from shaavan/issue2882
Introduce ResponseInstructions for OnionMessage Handling
Matt Corallo [Wed, 8 May 2024 20:35:52 +0000 (13:35 -0700)]
Merge pull request #3012 from TheBlueMatt/2024-04-0.0.123-rl
Add draft release notes for 0.0.123
Matt Corallo [Wed, 8 May 2024 20:24:31 +0000 (13:24 -0700)]
Merge pull request #3054 from TheBlueMatt/2024-04-fuzz-bolt11
Add fuzzing coverage for BOLT11 invoice deserialization
Matt Corallo [Fri, 19 Apr 2024 15:33:58 +0000 (15:33 +0000)]
Bump `possiblyrandom` to 0.2
I'd uploaded `possiblyrandom` 0.1 to reserve the crate name but
with a dummy library so now we need ot use 0.2 for the release.
Matt Corallo [Fri, 19 Apr 2024 15:24:32 +0000 (15:24 +0000)]
Add changelog entries for 0.0.123
Matt Corallo [Tue, 30 Apr 2024 17:11:54 +0000 (17:11 +0000)]
Use consistent byte/char offsets when parsing invoice HRPs
When parsing lightning-invoice HRPs we want to read them
char-by-char, tracking at which offset different fields were. Prior
to this commit this was done first by reading char-by-char and then
by indexing using the byte offset which works for ASCII strings but
fails on multi-byte characters.
This commit fixes this issue by simply always walking byte-by-byte
and rejecting multi-byte characters which don't belong in HRPs.
Matt Corallo [Tue, 30 Apr 2024 14:31:57 +0000 (14:31 +0000)]
Substantially increase coverage in BOLT11 deserialization fuzzer
Matt Corallo [Tue, 30 Apr 2024 13:58:21 +0000 (13:58 +0000)]
Move existing BOLT11 fuzz test to the `fuzz` crate
Matt Corallo [Wed, 8 May 2024 19:24:04 +0000 (12:24 -0700)]
Merge pull request #3046 from TheBlueMatt/2024-03-fees-are-dust
Fix the `full_stack_target` breakage test and doc feerate requests
shaavan [Thu, 18 Apr 2024 11:31:52 +0000 (17:01 +0530)]
Implement ResponseInstruction Usage in OnionMessage Handling
This commit integrates the newly introduced ResponseInstruction structs
and enums into the codebase for handling OnionMessage responses.
Matt Corallo [Tue, 7 May 2024 16:34:36 +0000 (16:34 +0000)]
Fix the `full_stack_target` breakage test and doc feerate requests
When we added the additional deust exposure checks in
702196819e6445048b803574fcacef77d5ce8c9c we added several
additional feerate fetches which broke the `full_stack_target`
change-detection test.
This updates the hard-coded test to support the new feerate fetches
and also includes a comment on `FeeEstimator` to indicate that
users really need to be caching feerates as otherwise they'll slow
us down.
Matt Corallo [Tue, 7 May 2024 15:50:46 +0000 (08:50 -0700)]
Merge pull request #3045 from TheBlueMatt/2024-03-fees-are-dust
Include excess counterparty commitment transaction fees in dust exposure
Matt Corallo [Sun, 5 May 2024 02:00:42 +0000 (02:00 +0000)]
Add a simple test of the new excess-fees-are-dust behavior
Matt Corallo [Sun, 5 May 2024 00:44:07 +0000 (00:44 +0000)]
Update default dust exposure limit and the documentation thereof
Now that we're including excess counterparty commitment transaction
fees in our dust calculation, we need to update the docs
accordingly. We do so here, describing some of the considerations
and risks that come with the new changes.
We also take this opportunity to double the default value, as users
have regularly complained that non-anchor channels fail to send
HTLCs with the default settings with some feerates.
Fixes #2922
Matt Corallo [Tue, 30 Apr 2024 20:42:36 +0000 (20:42 +0000)]
Include excess commitment transaction fees in dust exposure
Transaction fees on counterparty commitment transactions are
ultimately not our money and thus are really "dust" from our PoV -
they're funds that may be ours during off-chain updates but are not
ours once we go on-chain.
Thus, here, we count any such fees in excess of our own fee
estimates towards dust exposure. We don't bother to make an
inbound/outbound channel distinction here as in most cases users
will use `MaxDustExposure::FeeRateMultiplier` which will scale
with the fee we set on outbound channels anyway.
Note that this also enables the dust exposure checks on anchor
channels during feerate updates. We'd previously elided these as
increases in the channel feerates do not change the HTLC dust
exposure, but now do for the fee dust exposure.
Gursharan Singh [Mon, 6 May 2024 20:00:52 +0000 (13:00 -0700)]
Stop tracking chain_sync_monitor_persistences in TestPersister
Gursharan Singh [Mon, 6 May 2024 18:06:13 +0000 (11:06 -0700)]
Make ChannelMonitor chain-sync log a trace log
Gursharan Singh [Mon, 6 May 2024 18:04:50 +0000 (11:04 -0700)]
Minor Doc fixes after #2957
Matt Corallo [Mon, 6 May 2024 19:20:37 +0000 (12:20 -0700)]
Merge pull request #3039 from valentinewallace/2024-04-invoice-amt-msats-overflow
Fix overflow in invoice amount setter.
Matt Corallo [Mon, 6 May 2024 19:08:10 +0000 (12:08 -0700)]
Merge pull request #2957 from G8XSU/pause-events
Don't pause events for chainsync persistence
Valentine Wallace [Tue, 30 Apr 2024 17:01:03 +0000 (13:01 -0400)]
Fix overflow in invoice amount setter.
Matt Corallo [Sun, 5 May 2024 19:52:58 +0000 (19:52 +0000)]
Provide more color in filter registration methods
A few years ago we had repeated user confusion dealing with the
`Filter` methods and exactly how they differ. Here we try to add a
bit more color in several ways as suggested by users in a few
places - listing examples of why the methods are used as well as
ensuring its clearly communicated that not all parameters need be
used.
Fixes #1069