Commit graph

4734 commits

Author SHA1 Message Date
valentinewallace
1237abffa7
Merge pull request #3036 from TheBlueMatt/2024-05-filter-color
Provide more color in filter registration methods
2024-05-14 16:23:30 -07:00
Matt Corallo
e1d00063e2 Allow any Deref to an EntropySource in BlindedPath building
This matches our normal API semantics and allows, for example,
`Arc`s to `EntropySource`s.
2024-05-14 13:17:03 +00:00
Matt Corallo
bccddcaabd 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.
2024-05-14 13:17:03 +00:00
Matt Corallo
7e69d835b2 Expose ChannelManager offer constructors in bindings 2024-05-13 18:55:22 +00:00
Matt Corallo
3da85c94ff Mark io_extras as no-bindings-export as its not for public use 2024-05-13 18:55:22 +00:00
Matt Corallo
6bc2a573bb 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.
2024-05-13 18:55:22 +00:00
Matt Corallo
5c21ee98a8 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`.
2024-05-13 18:55:22 +00:00
Matt Corallo
58febc36d1 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]`.
2024-05-13 18:55:22 +00:00
Matt Corallo
3fc3166b28 Skip BestBlock::new in bindings as we already have one 2024-05-13 18:55:22 +00:00
Matt Corallo
1890e8049b
Merge pull request #3058 from benthecarman/deref-empty-nod-id-lookup
impl Deref for EmptyNodeIdLookUp
2024-05-13 06:09:31 -07:00
Jeffrey Czyz
efc75794f4
Remove WriteableEcdsaChannelSigner trait
WriteableEcdsaChannelSigner is no longer needed now that
EcdsaChannelSigner isn't written in OnchainTxHandler.
2024-05-10 17:17:41 -05:00
Jeffrey Czyz
ae98eccfa9
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.
2024-05-10 17:17:34 -05:00
Matt Corallo
0ffa4b3579
Merge pull request #2930 from jbesraa/Add-PaymentHash-to-Record
Add `PaymentHash` to `Record`
2024-05-10 09:55:55 -07:00
Arik
8f1dc54e6d
Merge pull request #2973 from valentinewallace/2024-03-om-mailbox
Support intercepting onion messages for offline peers
2024-05-09 15:27:49 -07:00
benthecarman
bfff6fda6e
impl Deref for EmptyNodeIdLookUp 2024-05-09 15:58:19 -05:00
Valentine Wallace
a5ada64866
Fill in top-level docs for onion message offline peer interception. 2024-05-09 15:29:48 -04:00
Valentine Wallace
edc86e319f
Limit OnionMessenger event buffer size. 2024-05-09 15:29:44 -04:00
Valentine Wallace
6613f1f0d2
Manually implement Debug for onion message packets.
Previously we derived Debug, but that caused a lot of unreadable encrypted
bytes to be printed.
2024-05-09 15:29:44 -04:00
Valentine Wallace
be31e632c2
Test offline peer onion message interception. 2024-05-09 15:29:41 -04:00
Valentine Wallace
4c7ecaaa3f
Fix outdated comment in onion message functional test. 2024-05-09 15:29:41 -04:00
Valentine Wallace
1fc8f115af
Refactor MessengerNode test util construction to take config.
Will be used in the next commit when another config parameter is added.
2024-05-09 15:29:41 -04:00
Valentine Wallace
7213458b82
Support forwarding prebuilt onion messages in OnionMessenger. 2024-05-09 15:29:38 -04:00
Valentine Wallace
1c28cc0713
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.
2024-05-09 15:29:34 -04:00
Valentine Wallace
e8f7fe1919
Support generating events when an OM for an offline peer is received.
Docs will be added in upcoming commits.
2024-05-09 15:29:29 -04:00
Matt Corallo
33b9ba558c
Merge pull request #3041 from G8XSU/followup-2957
Followups to #2957
2024-05-09 09:47:41 -07:00
jbesraa
fe7f548ebb
Add payment_hash to WithChannelMonitor 2024-05-09 11:59:39 +03:00
esraa
3fb329b004
Add PaymentHash to Record
Adding the `payment_hash` to `Record` so we are able to track it
    in logs.
2024-05-09 11:57:53 +03:00
Jeffrey Czyz
38690bf50a
Merge pull request #2907 from shaavan/issue2882
Introduce ResponseInstructions for OnionMessage Handling
2024-05-08 17:32:41 -05:00
Matt Corallo
74c9f9b183
Merge pull request #3012 from TheBlueMatt/2024-04-0.0.123-rl
Add draft release notes for 0.0.123
2024-05-08 13:35:52 -07:00
Matt Corallo
2804377f9e 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.
2024-05-08 20:08:52 +00:00
shaavan
15d016ac52 Implement ResponseInstruction Usage in OnionMessage Handling
This commit integrates the newly introduced ResponseInstruction structs
and enums into the codebase for handling OnionMessage responses.
2024-05-08 17:57:57 +05:30
Matt Corallo
28d85af955 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.
2024-05-07 16:51:38 +00:00
Matt Corallo
d1ac0717fe
Merge pull request #3045 from TheBlueMatt/2024-03-fees-are-dust
Include excess counterparty commitment transaction fees in dust exposure
2024-05-07 08:50:46 -07:00
Matt Corallo
5091c1fd68 Add a simple test of the new excess-fees-are-dust behavior 2024-05-07 14:13:55 +00:00
Matt Corallo
f0b3708c20 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
2024-05-07 14:13:55 +00:00
Matt Corallo
51bf78d604 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.
2024-05-07 14:13:55 +00:00
Gursharan Singh
8861a9acfa
Stop tracking chain_sync_monitor_persistences in TestPersister 2024-05-06 13:00:52 -07:00
Gursharan Singh
7cd6030886
Make ChannelMonitor chain-sync log a trace log 2024-05-06 12:55:28 -07:00
Gursharan Singh
a5933ae248
Minor Doc fixes after #2957 2024-05-06 12:55:19 -07:00
Matt Corallo
b8d4ac1371
Merge pull request #2957 from G8XSU/pause-events
Don't pause events for chainsync persistence
2024-05-06 12:08:10 -07:00
Matt Corallo
57644f6a81 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
2024-05-05 19:52:58 +00:00
Matt Corallo
37c431ad68
Merge pull request #3035 from TheBlueMatt/2024-04-upstream-123-bindings 2024-05-03 17:55:25 -07:00
Matt Corallo
a27088d6aa
Merge pull request #3018 from jkczyz/2024-04-optional-description
Optional description for `Offer` and `Refund`
2024-05-03 12:55:17 -07:00
Matt Corallo
3d5a6913b5
Merge pull request #3029 from TheBlueMatt/2024-04-fix-batch-funding-failures
Add error handling for channels which fail to be created in `funding_transaction_generated_intern`
2024-05-03 12:17:58 -07:00
shaavan
e640951f95 Introduce ResponseInstructions for OnionMessage Handling
- Currently, handle_message (or handle_custom_message) only exposes
  the generated response for an OnionMessage, lacking the necessary
  reply_path for asynchronous responses.

- This commit introduces a new flow for OnionMessage handling.

- Instead of solely taking the message as input, handle_message now accepts
  an Optional `responder`, returning a `ResponseInstruction` containing both
  the response and the reply_path.

- `ResponseInstruction` utilizes different enum variants to indicate how
  `handle_onion_message_response` should handle the response.

- This enhancement enables exposing the reply_path alongside the response
  and allows for more complex response mechanisms, such as responding with
  an added reply_path.

- The commit introduces the foundational framework (structs & enums) for this new flow.
2024-05-03 17:26:19 +05:30
Jeffrey Czyz
e61001f60d
Only require description when offer has an amount
The spec was changed to allow excluding an offer description if the
offer doesn't have an amount. However, it is still required when the
amount is set.
2024-05-02 16:42:27 -05:00
Matt Corallo
11c3d7001b Swap UserConfig::default() for test_default_channel_config
As LDK changes, `UserConfig::default()` may imply marginally
different behavior, whereas `test_default_channel_config` is
intended to tweak defaults to provide a stable behavior for test
contexts.

This commit changes a few uses of `UserConfig::default()` to
`test_default_channel_config` in cases that will fail over the
coming commits due to dust changes.
2024-05-02 15:39:03 +00:00
Matt Corallo
0e831b4bd0 Correct indentation in get_pending_htlc_stats
The previous commit left indentation in `get_pending_htlc_stats`
deliberately wrong, to ease reviewability. This commit fixes the
indentation.
2024-05-02 15:39:03 +00:00
Matt Corallo
2937000051 Unify get_{inbound,outbound}_pending_htlc_stats
In most cases we already call both in a pair, and in fact always
consolidate some of the returned values across both accessors, so
there's not much reason to have them be separate methods.

Here we merge them.
2024-05-02 15:39:03 +00:00
Matt Corallo
021979b5dd Wake background-processor from ChainMonitor on new blocks
When we receive a new block we may generate
`Event::SpendableOutputs` in `ChannelMonitor`s which then need to
be processed by the background processor. While it will do so
eventually when its normal loop goes around, this may cause user
tests to be delayed in finding events, so we should notify the BP
immediately to wake it on new blocks.

We implement that here, unconditionally notifying the
`background-processor` whenever we receive a new block or confirmed
transactions.
2024-05-01 19:42:24 +00:00