rust-lightning
5 months agoAdd missing `unwrap` in `reload_tests.rs` 2023-12-2314-cleanups-2
Matt Corallo [Sat, 2 Dec 2023 19:16:40 +0000 (19:16 +0000)]
Add missing `unwrap` in `reload_tests.rs`

5 months agoMarginally optimize test logging
Matt Corallo [Sat, 2 Dec 2023 19:13:02 +0000 (19:13 +0000)]
Marginally optimize test logging

973636bd2ab2ba35fb8b9703f1d5d0e72f069cdc introduced a new `HashMap`
in the `TestLogger` but then did lookups by iterating the entire
map. This fixes that, and also takes this opportunity to stop
allocating new `String`s for the module to store each log entry in
the `TestLogger`

5 months agoMerge pull request #2314 from henghonglee/issue-2292
Matt Corallo [Sat, 2 Dec 2023 17:43:32 +0000 (17:43 +0000)]
Merge pull request #2314 from henghonglee/issue-2292

Add peer_id and channel_id explicitly to log records

5 months agoRefactor ChainMonitor::update_channel error case
Jeffrey Czyz [Wed, 29 Nov 2023 16:51:33 +0000 (10:51 -0600)]
Refactor ChainMonitor::update_channel error case

Move the handling of ChannelMonitorUpdateStatus::UnrecoverableError to
the point of error to avoid needing an unwrap later when re-wrapping the
logger.

5 months agoRemove unused handle_error macro rule
Jeffrey Czyz [Sun, 26 Nov 2023 15:55:27 +0000 (10:55 -0500)]
Remove unused handle_error macro rule

5 months agoUse wrapper to add context to logging
henghonglee [Wed, 6 Sep 2023 02:37:54 +0000 (10:37 +0800)]
Use wrapper to add context to logging

Using a decorator pattern, add peer_id and channel_id to Record
stored on Logger.

5 months agoAdd WithChannelMonitor
henghonglee [Mon, 4 Sep 2023 18:05:15 +0000 (02:05 +0800)]
Add WithChannelMonitor

5 months agoAdd WithChannelContext
henghonglee [Tue, 5 Sep 2023 03:35:51 +0000 (11:35 +0800)]
Add WithChannelContext

5 months agoAdd WithChannelDetails
henghonglee [Mon, 4 Sep 2023 17:51:30 +0000 (01:51 +0800)]
Add WithChannelDetails

5 months agoAdd WithContext and Tests
henghonglee [Mon, 4 Sep 2023 18:37:39 +0000 (02:37 +0800)]
Add WithContext and Tests

5 months agoAdd semantics to logger::Records
Jeffrey Czyz [Tue, 21 Nov 2023 16:47:12 +0000 (10:47 -0600)]
Add semantics to logger::Records

Include optional peer and channel ids to logger::Record. This will be
used by wrappers around Logger in order to provide more context (e.g.,
the peer that sent a message, the channel an operation is pertaining to,
etc.). Implementations of Logger can include this as metadata to aid in
searching logs.

5 months agoPass Record by value to Logger
henghonglee [Tue, 8 Aug 2023 04:01:11 +0000 (12:01 +0800)]
Pass Record by value to Logger

Instead of passing a reference to a Record, pass the Logger an owned
Record so that it can be decorated with semantic context.

5 months agoMerge pull request #2540 from valentinewallace/2023-08-blinded-errors
valentinewallace [Fri, 1 Dec 2023 04:29:10 +0000 (23:29 -0500)]
Merge pull request #2540 from valentinewallace/2023-08-blinded-errors

Route blinding: support forwarding as the intro node

5 months agoTest blinding point serialization in Channel.
Valentine Wallace [Mon, 13 Nov 2023 20:52:18 +0000 (15:52 -0500)]
Test blinding point serialization in Channel.

5 months agoAdd release note for blinded HTLC backwards compat.
Valentine Wallace [Tue, 7 Nov 2023 19:47:26 +0000 (14:47 -0500)]
Add release note for blinded HTLC backwards compat.

5 months agoTest intro node failing blinded intercept HTLC.
Valentine Wallace [Tue, 31 Oct 2023 17:28:15 +0000 (13:28 -0400)]
Test intro node failing blinded intercept HTLC.

5 months agoTest intro node blinded HTLC failing in process_pending_htlc_fwds.
Valentine Wallace [Tue, 31 Oct 2023 17:27:50 +0000 (13:27 -0400)]
Test intro node blinded HTLC failing in process_pending_htlc_fwds.

5 months agoCorrectly fail back downstream-failed blinded HTLCs as intro
Valentine Wallace [Mon, 9 Oct 2023 02:10:17 +0000 (16:10 -1000)]
Correctly fail back downstream-failed blinded HTLCs as intro

5 months agoCorrectly fail back blinded inbound fwd HTLCs when adding to a Channel
Valentine Wallace [Tue, 3 Oct 2023 00:13:25 +0000 (14:13 -1000)]
Correctly fail back blinded inbound fwd HTLCs when adding to a Channel

As the intro node.

5 months agoExtract blinded route param creation into test util
Valentine Wallace [Mon, 2 Oct 2023 22:23:48 +0000 (18:23 -0400)]
Extract blinded route param creation into test util

5 months agoCorrectly fail back on outbound channel check for blinded HTLC
Valentine Wallace [Fri, 15 Sep 2023 22:21:28 +0000 (18:21 -0400)]
Correctly fail back on outbound channel check for blinded HTLC

Forwarding intro nodes should always fail with 0x8000|0x4000|24.

5 months agoTest blinded forwarding payload encoded as receive error case
Valentine Wallace [Fri, 15 Sep 2023 23:47:25 +0000 (19:47 -0400)]
Test blinded forwarding payload encoded as receive error case

5 months agoTest blinded forward failure to calculate outbound cltv expiry
Valentine Wallace [Fri, 15 Sep 2023 22:10:22 +0000 (18:10 -0400)]
Test blinded forward failure to calculate outbound cltv expiry

Intro node failure only.

5 months agoRemove now-unused Readable impl for ReceiveTlvs
Valentine Wallace [Wed, 25 Oct 2023 21:44:51 +0000 (17:44 -0400)]
Remove now-unused Readable impl for ReceiveTlvs

5 months agoSupport forwarding blinded HTLCs as intro node.
Valentine Wallace [Thu, 26 Oct 2023 18:37:13 +0000 (14:37 -0400)]
Support forwarding blinded HTLCs as intro node.

Error handling will be completed in upcoming commits.

5 months agoParse blinded forward-as-intro onion payloads
Valentine Wallace [Thu, 26 Oct 2023 18:28:45 +0000 (14:28 -0400)]
Parse blinded forward-as-intro onion payloads

Previously, we only parsed blinded receive payloads.

5 months agoSet update_add blinding point on HTLC forward
Valentine Wallace [Thu, 26 Oct 2023 18:24:10 +0000 (14:24 -0400)]
Set update_add blinding point on HTLC forward

Used by the next hop to decode their blinded onion payload.

5 months agoParameterize Channel's htlc forward method by outbound blinding point
Valentine Wallace [Thu, 26 Oct 2023 18:18:18 +0000 (14:18 -0400)]
Parameterize Channel's htlc forward method by outbound blinding point

Used in the next commit to set the update_add blinding point on HTLC forward.

5 months agoSet HTLCPreviousHopData::blinded on intro node forward.
Valentine Wallace [Thu, 26 Oct 2023 22:18:28 +0000 (18:18 -0400)]
Set HTLCPreviousHopData::blinded on intro node forward.

Useful so we know to fail back blinded HTLCs where we are the intro node with
the invalid_onion_blinding error per BOLT 4.

We don't set this field for blinded received HTLCs because we don't support
receiving to multi-hop blinded paths yet, and there's no point in setting it
for HTLCs received to 1-hop blinded paths because per the spec they should fail
back using an unblinded error code.

5 months agoPersist whether an HTLC is blinded in HTLCPreviousHopData.
Valentine Wallace [Thu, 26 Oct 2023 21:35:22 +0000 (17:35 -0400)]
Persist whether an HTLC is blinded in HTLCPreviousHopData.

Useful so we know to fail blinded intro node HTLCs back with an
invalid_onion_blinding error per BOLT 4.

Another variant will be added to the new Blinded enum when we support
receiving/forwarding as a non-intro node.

5 months agoStore whether a forwarded HTLC is blinded in PendingHTLCRouting
Valentine Wallace [Thu, 26 Oct 2023 21:26:18 +0000 (17:26 -0400)]
Store whether a forwarded HTLC is blinded in PendingHTLCRouting

We need to store the inbound blinding point in PendingHTLCRouting in order to
calculate the outbound blinding point.

The new BlindedForward struct will be augmented when we add support for
forwarding as a non-intro node.

5 months agoPersist outbound blinding points in Channel
Valentine Wallace [Thu, 13 Jul 2023 01:36:11 +0000 (21:36 -0400)]
Persist outbound blinding points in Channel

A blinding point is provided in update_add_htlc messages if we are relaying or
receiving a payment within a blinded path, to decrypt the onion routing packet
and the recipient-provided encrypted payload within. Will be used in upcoming
commits.

5 months agoParse blinded onion errors in tests only.
Valentine Wallace [Thu, 26 Oct 2023 17:09:48 +0000 (13:09 -0400)]
Parse blinded onion errors in tests only.

So we can make sure they're encoded properly.

5 months agoonion_utils: extract decrypting faiure packet into method
Valentine Wallace [Thu, 26 Oct 2023 16:59:42 +0000 (12:59 -0400)]
onion_utils: extract decrypting faiure packet into method

Will be used in the next commit to parse onion errors from blinded paths in
tests only.

5 months agoParse blinding point in UpdateAddHTLC
Valentine Wallace [Thu, 23 Mar 2023 22:56:11 +0000 (18:56 -0400)]
Parse blinding point in UpdateAddHTLC

A blinding point is provided in update_add_htlc messages if we are relaying or
receiving a payment within a blinded path, to decrypt the onion routing packet
and the recipient-provided encrypted payload within. Will be used in upcoming
commits.

5 months agoMerge pull request #2739 from Evanfeenstra/channelmanager-utils
valentinewallace [Wed, 29 Nov 2023 20:41:26 +0000 (15:41 -0500)]
Merge pull request #2739 from Evanfeenstra/channelmanager-utils

move static channelmanager functions into their own file

5 months agoMerge pull request #2721 from TheBlueMatt/2023-11-log-forward-peer
Wilmer Paulino [Wed, 29 Nov 2023 18:03:56 +0000 (10:03 -0800)]
Merge pull request #2721 from TheBlueMatt/2023-11-log-forward-peer

Handle missing case in reestablish local commitment number checks

5 months agoMerge pull request #2755 from arik-so/arik/taproot-2023-11-followup-2512
Matt Corallo [Wed, 29 Nov 2023 04:28:50 +0000 (04:28 +0000)]
Merge pull request #2755 from arik-so/arik/taproot-2023-11-followup-2512

Followups to 2512

5 months agoRemove unused Taproot import.
Arik Sosman [Wed, 29 Nov 2023 00:18:35 +0000 (16:18 -0800)]
Remove unused Taproot import.

5 months agoMove validate_counterparty_revocation to ChannelSigner.
Arik Sosman [Wed, 29 Nov 2023 00:14:09 +0000 (16:14 -0800)]
Move validate_counterparty_revocation to ChannelSigner.

5 months agoRemove superfluous commitment_number parameter.
Arik Sosman [Wed, 29 Nov 2023 00:11:15 +0000 (16:11 -0800)]
Remove superfluous commitment_number parameter.

5 months agoGate Taproot-related todos behind cfg flag.
Arik Sosman [Wed, 29 Nov 2023 00:08:10 +0000 (16:08 -0800)]
Gate Taproot-related todos behind cfg flag.

5 months agomove static channelmanager functions into their own file
Evan Feenstra [Thu, 16 Nov 2023 23:24:55 +0000 (15:24 -0800)]
move static channelmanager functions into their own file

5 months agoMerge pull request #2512 from arik-so/taproot/2023-08-taproot-signer-variant
Matt Corallo [Tue, 28 Nov 2023 18:10:53 +0000 (18:10 +0000)]
Merge pull request #2512 from arik-so/taproot/2023-08-taproot-signer-variant

Taproot signer variant

5 months agoMerge pull request #2749 from TheBlueMatt/2023-11-2744-followups
Wilmer Paulino [Tue, 28 Nov 2023 16:56:25 +0000 (08:56 -0800)]
Merge pull request #2749 from TheBlueMatt/2023-11-2744-followups

Add `channel_keys_id` to `SpendableOutputDescriptor::StaticOutput`

5 months agoMove ECDSA-specific signers into ecdsa.rs
Arik Sosman [Mon, 28 Aug 2023 23:06:41 +0000 (16:06 -0700)]
Move ECDSA-specific signers into ecdsa.rs

To separate out the logic in the `sign` module, which will start to be
convoluted with multiple signer types, we're splitting out each signer
type into its own submodule, following the taproot.rs example from a
previous commit.

5 months agoReparametrize ChannelSignerType by SignerProvider.
Arik Sosman [Mon, 6 Nov 2023 05:51:15 +0000 (21:51 -0800)]
Reparametrize ChannelSignerType by SignerProvider.

ChannelSignerType is an enum that contains variants of all currently
supported signer types. Given that those signer types are enumerated
as associated types in multiple places, it is prudent to denote one
type as the authority on signer types.

SignerProvider seemed like the best option. Thus, instead of
ChannelSignerType declaring the associated types itself, it simply
uses their definitions from SignerProvider.

5 months agoAdd TaprootSigner variant to SignerProvider.
Arik Sosman [Mon, 6 Nov 2023 05:36:59 +0000 (21:36 -0800)]
Add TaprootSigner variant to SignerProvider.

Previously, SignerProvider was not laid out to support multiple signer
types. However, with the distinction between ECDSA and Taproot signers,
we now need to account for SignerProviders needing to support both.

This approach does mean that if ever we introduced another signer type
in the future, all implementers of SignerProvider would need to add it
as an associated type, and would also need to write a set of dummy
implementations for any Signer trait they do not wish to support.

For the time being, the TaprootSigner associated type is cfg-gated.

5 months agoIntroduce TaprootSigner trait.
Arik Sosman [Sun, 7 May 2023 04:13:53 +0000 (21:13 -0700)]
Introduce TaprootSigner trait.

For Taproot support, we need to define an alternative trait to
EcdsaChannelSigner. This trait will be implemented by all signers
that wish to support Taproot channels.

5 months agoRename SignerProvider's Signer to EcdsaSigner.
Arik Sosman [Tue, 22 Aug 2023 05:37:58 +0000 (22:37 -0700)]
Rename SignerProvider's Signer to EcdsaSigner.

5 months agoHandle missing case in reestablish local commitment number checks 2023-11-log-forward-peer
Matt Corallo [Thu, 9 Nov 2023 04:14:15 +0000 (04:14 +0000)]
Handle missing case in reestablish local commitment number checks

If we're behind exactly one commitment (which we've revoked), we'd
previously force-close the channel, guaranteeing we'll lose funds
as the counterparty has our latest local commitment state's
revocation secret.

While this shouldn't happen because users should never lose data,
sometimes issues happen, and we should ensure we always panic.

Further, `test_data_loss_protect` is updated to test this case.

5 months agoClean up error messages and conditionals in reestablish handling
Matt Corallo [Thu, 9 Nov 2023 03:28:45 +0000 (03:28 +0000)]
Clean up error messages and conditionals in reestablish handling

When we reestablish there are generally always 4 conditions for
both local and remote commitment transactions:
 * we're stale and have possibly lost data
 * we're ahead and the peer has lost data
 * we're caught up
 * we're nearly caught up and need to retransmit one update.

In especially the local commitment case we had a mess of different
comparisons, which is improved here. Further, the error messages
are clarified and include more information.

5 months agoAdd `channel_keys_id` to `SpendableOutputDescriptor::StaticOutput` 2023-11-2744-followups
Matt Corallo [Mon, 27 Nov 2023 21:37:42 +0000 (21:37 +0000)]
Add `channel_keys_id` to `SpendableOutputDescriptor::StaticOutput`

In 7f0fd868ad4e8072440f1eb79e78894de1629157, `channel_keys_id` was
added as an argument to `SignerProvider::get_destination_script`,
allowing implementors to generate a new script for each channel.

This is great, however users then have no way to re-derive the
corresponding private key when they ultimately receive a
`SpendableOutputDescriptor::StaticOutput`. Instead, they have to
track all the addresses as they derive them separately. In many
cases this is fine, but we should support both deployments, which
we do here by simply including the missing `channel_keys_id` for
the user.

5 months agoMerge pull request #2744 from rmalonson/destinationscript
Wilmer Paulino [Mon, 27 Nov 2023 20:20:19 +0000 (12:20 -0800)]
Merge pull request #2744 from rmalonson/destinationscript

Add channel_keys_id as param in get_destination_script to support gen…

5 months agoMerge pull request #2675 from yellowred/delayed_payment_key_types
Matt Corallo [Mon, 27 Nov 2023 18:57:37 +0000 (18:57 +0000)]
Merge pull request #2675 from yellowred/delayed_payment_key_types

Implement struct wrappers for Payment, DelayedPayment, HTLC and Revocation channel keys

5 months agoAdd channel_keys_id as param in get_destination_script
Rachel Malonson [Wed, 22 Nov 2023 20:24:20 +0000 (12:24 -0800)]
Add channel_keys_id as param in get_destination_script

This enables implementers to generate a different destination script for each channel.

5 months agoImplement struct wrappers for channel key types to avoid confusion.
olegkubrakov [Tue, 14 Nov 2023 18:08:25 +0000 (10:08 -0800)]
Implement struct wrappers for channel key types to avoid confusion.

Currently all channel keys and their basepoints exist uniformly as
`PublicKey` type, which not only makes in harder for a developer to
distinguish those entities, but also does not engage the language
type system to check if the correct key is being used in any
particular function.

Having struct wrappers around keys also enables more nuanced
semantics allowing to express Lightning Protocol rules in language.
For example, the code allows to derive `HtlcKey` from
`HtlcBasepoint` and not from `PaymentBasepoint`.

This change is transparent for channel monitors that will use the
internal public key of a wrapper.

Payment, DelayedPayment, HTLC and Revocation basepoints and their
derived keys are now wrapped into a specific struct that make it
distinguishable for the Rust type system. Functions that require a
specific key or basepoint should not use generic Public Key, but
require a specific key wrapper struct to engage Rust type
verification system and make it more clear for developers which
key is used.

5 months agoMerge pull request #2685 from tnull/2022-12-add-electrum-sync
Matt Corallo [Mon, 27 Nov 2023 17:10:00 +0000 (17:10 +0000)]
Merge pull request #2685 from tnull/2022-12-add-electrum-sync

Add electrum support to `lightning-transaction-sync`

5 months agoMerge pull request #2741 from shaavan/issue-2215
Elias Rohrer [Mon, 27 Nov 2023 12:13:08 +0000 (13:13 +0100)]
Merge pull request #2741 from shaavan/issue-2215

Explicitly reject routes that double-back

5 months agoMerge pull request #2746 from TheBlueMatt/2023-11-bitcoin-0.30-followups
Elias Rohrer [Mon, 27 Nov 2023 11:53:17 +0000 (12:53 +0100)]
Merge pull request #2746 from TheBlueMatt/2023-11-bitcoin-0.30-followups

Drop panic if rust-bitcoin adds a new Network

5 months agoRemove now-redundant checks in BOLT12 `Invoice` fallback addresses 2023-11-bitcoin-0.30-followups
Matt Corallo [Sun, 26 Nov 2023 19:09:06 +0000 (19:09 +0000)]
Remove now-redundant checks in BOLT12 `Invoice` fallback addresses

Now that we use the `rust-bitcoin` `WitnessProgram` to check our
addresses, we can just rely on it, rather than checking the program
length and version.

5 months agoDrop panic if `rust-bitcoin` adds a new `Network`
Matt Corallo [Sun, 26 Nov 2023 19:07:10 +0000 (19:07 +0000)]
Drop panic if `rust-bitcoin` adds a new `Network`

`rust-bitcoin` 0.30 added `#[non_exhaustive]` to the `Network`
enum, allowing them to "add support" for a new network type without
a major version change in the future. When upgrading, we added a
simple `unreachable` for the general match arm, which would break
in a minor version change of `rust-bitcoin`.

While it seems [possible rust-bitcoin will change
this](https://github.com/rust-bitcoin/rust-bitcoin/issues/2225),
we still shouldn't ba panicking, which we drop here in favor of a
`debug_assert`ion, and a default value.

5 months agoAdd test for PathParameterError introduced in previous commit
shaavan [Fri, 24 Nov 2023 12:20:23 +0000 (17:50 +0530)]
Add test for PathParameterError introduced in previous commit

- Also modify the unwrap_send_err!() macro to handle the
  PathParameterError

5 months agoUse `esplora-client`'s `async-https-rustls` feature
Elias Rohrer [Fri, 24 Nov 2023 11:48:22 +0000 (12:48 +0100)]
Use `esplora-client`'s `async-https-rustls` feature

Now that we upgraded `esplora-client` to 0.6 we can use
`async-https-rustls` instead of manually overriding the `reqwest`
dependency.

5 months agoDRY up Esplora/Electrum `integration_tests`
Elias Rohrer [Mon, 13 Nov 2023 10:29:04 +0000 (11:29 +0100)]
DRY up Esplora/Electrum `integration_tests`

5 months agoAdd Electrum integration test
Elias Rohrer [Thu, 16 Nov 2023 11:04:14 +0000 (12:04 +0100)]
Add Electrum integration test

5 months agoImplement `ElectrumSyncClient`
Elias Rohrer [Mon, 23 Oct 2023 08:26:00 +0000 (10:26 +0200)]
Implement `ElectrumSyncClient`

5 months agoSet `pending_sync` when last-minute check fails in Esplora
Elias Rohrer [Thu, 16 Nov 2023 10:56:17 +0000 (11:56 +0100)]
Set `pending_sync` when last-minute check fails in Esplora

5 months agoMove `sync_` methods to `SyncState`
Elias Rohrer [Tue, 7 Nov 2023 08:21:40 +0000 (09:21 +0100)]
Move `sync_` methods to `SyncState`

5 months agoImprove `EsploraSyncClient` test coverage
Elias Rohrer [Wed, 25 Oct 2023 11:58:47 +0000 (13:58 +0200)]
Improve `EsploraSyncClient` test coverage

In particular, we now test `register_output` functionality, too.

5 months agoImprove `EsploraSyncClient` logging
Elias Rohrer [Wed, 25 Oct 2023 09:27:05 +0000 (11:27 +0200)]
Improve `EsploraSyncClient` logging

We give some more information while reducing the log levels to make the
logging less spammy.

We also convert one safe-to-unwrap case from returning an error to
unwrapping the value.

5 months agoUse upstream `TestLogger` util in tx sync tests
Elias Rohrer [Wed, 25 Oct 2023 08:59:13 +0000 (10:59 +0200)]
Use upstream `TestLogger` util in tx sync tests

5 months agoReturn confirmation height via `Confirm::get_relevant_txids`
Elias Rohrer [Mon, 13 Nov 2023 10:00:41 +0000 (11:00 +0100)]
Return confirmation height via `Confirm::get_relevant_txids`

We previously included the block hash, but it's also useful to include
the height under which we expect the respective transaction to be
confirmed.

5 months agoMerge pull request #2740 from wpaulino/rust-bitcoin-30-update
Elias Rohrer [Thu, 23 Nov 2023 08:28:41 +0000 (09:28 +0100)]
Merge pull request #2740 from wpaulino/rust-bitcoin-30-update

Update to rust-bitcoin v0.30.2

5 months agoRemove nightly warnings
Wilmer Paulino [Tue, 21 Nov 2023 01:05:52 +0000 (17:05 -0800)]
Remove nightly warnings

5 months agoBump rust-bitcoin to v0.30.2
Wilmer Paulino [Thu, 27 Apr 2023 07:16:40 +0000 (00:16 -0700)]
Bump rust-bitcoin to v0.30.2

5 months agoExplicitly reject routes that double-back
shaavan [Tue, 21 Nov 2023 14:41:46 +0000 (20:11 +0530)]
Explicitly reject routes that double-back

- If a path within a route passes through the same channelID twice,
  that shows the path is looped and will be rejected by nodes.
- Add a check to explicitly reject such payment before trying to send
  them.

5 months agoMerge pull request #2700 from Evanfeenstra/pub-htlc-routing
Matt Corallo [Thu, 16 Nov 2023 17:02:05 +0000 (17:02 +0000)]
Merge pull request #2700 from Evanfeenstra/pub-htlc-routing

peel_payment_onion static fn in channelmanager

5 months agoMerge pull request #2730 from benthecarman/invoice-utils
Matt Corallo [Wed, 15 Nov 2023 22:01:33 +0000 (22:01 +0000)]
Merge pull request #2730 from benthecarman/invoice-utils

Add some public utilities to `lightning_invoice`

5 months agoInboundOnionErr fields public
Evan Feenstra [Wed, 15 Nov 2023 21:08:56 +0000 (13:08 -0800)]
InboundOnionErr fields public

5 months agoHave Invoice Description use UntrustedString
benthecarman [Tue, 14 Nov 2023 16:14:30 +0000 (10:14 -0600)]
Have Invoice Description use UntrustedString

5 months agoMake invoice fields public
benthecarman [Fri, 10 Nov 2023 22:12:43 +0000 (16:12 -0600)]
Make invoice fields public

5 months agoMerge pull request #2696 from TheBlueMatt/2023-10-no-chan-feerate-upper-bound
Elias Rohrer [Wed, 15 Nov 2023 09:25:06 +0000 (10:25 +0100)]
Merge pull request #2696 from TheBlueMatt/2023-10-no-chan-feerate-upper-bound

Drop non-anchor channel fee upper bound limit entirely

5 months agoMerge pull request #2727 from TheBlueMatt/2023-11-better-bolt11-utils
Gursharan Singh [Tue, 14 Nov 2023 21:37:29 +0000 (13:37 -0800)]
Merge pull request #2727 from TheBlueMatt/2023-11-better-bolt11-utils

Replace maze of BOLT11 payment utilities with parameter generators

5 months agoremove obsolete comment
Evan Feenstra [Tue, 14 Nov 2023 19:56:31 +0000 (11:56 -0800)]
remove obsolete comment

5 months agopeel_payment_onion static fn in channelmanager
Evan Feenstra [Tue, 31 Oct 2023 23:51:14 +0000 (16:51 -0700)]
peel_payment_onion static fn in channelmanager

5 months agoMerge pull request #2529 from TheBlueMatt/2023-08-shutdown-remove-early-sign
Matt Corallo [Tue, 14 Nov 2023 19:09:46 +0000 (19:09 +0000)]
Merge pull request #2529 from TheBlueMatt/2023-08-shutdown-remove-early-sign

Don't send init `closing_signed` too early after final HTLC removal

5 months agoMerge pull request #2726 from shaavan/issue2712
Matt Corallo [Tue, 14 Nov 2023 17:57:19 +0000 (17:57 +0000)]
Merge pull request #2726 from shaavan/issue2712

Log the error, when trying to forward the intercepted HTLC, but the channel is not found

5 months agoLog the error, when trying to forward the intercepted HTLC, but the
shaavan [Fri, 10 Nov 2023 12:50:16 +0000 (18:20 +0530)]
Log the error, when trying to forward the intercepted HTLC, but the

channel is not found

5 months agoMerge pull request #2716 from TheBlueMatt/2023-11-hash-if-eq
Elias Rohrer [Tue, 14 Nov 2023 07:50:38 +0000 (08:50 +0100)]
Merge pull request #2716 from TheBlueMatt/2023-11-hash-if-eq

`derive(Hash)` for P2P messages

5 months ago`derive(Hash)` for P2P messages 2023-11-hash-if-eq
Matt Corallo [Mon, 13 Nov 2023 22:50:40 +0000 (22:50 +0000)]
`derive(Hash)` for P2P messages

In other languages (Java and C#, notably), overriding `Eq` without
overriding `Hash` can lead to surprising or broken behavior. Even
in Rust, its usually the case that you actually want both. Here we
add missing `Hash` derivations for P2P messages, to at least
address the first pile of warnings the C# compiler dumps.

5 months agoRely on const generic big arrays for `PartialEq` in msgs
Matt Corallo [Mon, 13 Nov 2023 22:48:48 +0000 (22:48 +0000)]
Rely on const generic big arrays for `PartialEq` in msgs

Implementation of standard traits on arrays longer than 32 elements
was shipped in rustc 1.47, which is below our MSRV of 1.48 and we
can use to remove some unnecessary manual implementation of
`PartialEq` on `OnionPacket`.

5 months agoMerge pull request #2544 from optout21/splicing-msgs0
Matt Corallo [Mon, 13 Nov 2023 22:38:51 +0000 (22:38 +0000)]
Merge pull request #2544 from optout21/splicing-msgs0

Add Splicing (and Quiescence) wire message definitions

5 months agoMerge pull request #2732 from arik-so/2023/11/update-musig2-dep
Matt Corallo [Mon, 13 Nov 2023 17:29:39 +0000 (17:29 +0000)]
Merge pull request #2732 from arik-so/2023/11/update-musig2-dep

Update MuSig2 dependency for Hash trait derivation.

5 months agoMerge pull request #2708 from TheBlueMatt/2023-11-less-graph-memory-frag
Matt Corallo [Mon, 13 Nov 2023 16:45:26 +0000 (16:45 +0000)]
Merge pull request #2708 from TheBlueMatt/2023-11-less-graph-memory-frag

Reduce common allocations across the codebase

5 months agoUpdate MuSig2 dependency for Hash trait derivation.
Arik Sosman [Mon, 13 Nov 2023 16:07:07 +0000 (11:07 -0500)]
Update MuSig2 dependency for Hash trait derivation.

5 months agoMerge pull request #2715 from valentinewallace/2023-11-skimmed-fees
Matt Corallo [Sun, 12 Nov 2023 20:27:25 +0000 (20:27 +0000)]
Merge pull request #2715 from valentinewallace/2023-11-skimmed-fees

Complete underpaying HTLCs support

5 months agoDrop old `expiry_time_from_unix_epoch` helper in expiry time lookup 2023-11-better-bolt11-utils
Matt Corallo [Sun, 12 Nov 2023 17:16:26 +0000 (17:16 +0000)]
Drop old `expiry_time_from_unix_epoch` helper in expiry time lookup

Since there's a much simpler way to go about it with
`Bolt11Invoice::expires_at`.

5 months agoMerge pull request #2722 from benthecarman/dust-overflow
Matt Corallo [Sun, 12 Nov 2023 17:03:09 +0000 (17:03 +0000)]
Merge pull request #2722 from benthecarman/dust-overflow

Fix potential cases where max_dust_htlc_exposure_msat overflows

5 months agoDon't send init `closing_signed` too early after final HTLC removal 2023-08-shutdown-remove-early-sign
Matt Corallo [Sat, 26 Aug 2023 19:59:21 +0000 (19:59 +0000)]
Don't send init `closing_signed` too early after final HTLC removal

If we remove an HTLC (or fee update), commit, and receive our
counterparty's `revoke_and_ack`, we remove all knowledge of said
HTLC (or fee update). However, the latest local commitment
transaction that we can broadcast still contains the HTLC (or old
fee), thus we are not eligible for initiating the `closing_signed`
negotiation if we're shutting down and are generally expecting a
counterparty `commitment_signed` immediately.

Because we don't have any tracking of these updates in the `Channel`
(only the `ChannelMonitor` is aware of the HTLC being in our latest
local commitment transaction), we'd previously send a
`closing_signed` too early, causing LDK<->LDK channels with an HTLC
pending towards the channel initiator at the time of `shutdown` to
always fail to cooperatively close.

To fix this race, we add an additional unpersisted bool to
`Channel` and use that to gate sending the initial `closing_signed`.