Commit Graph

71 Commits

Author SHA1 Message Date
Matt Corallo
f53a09d6dc
Merge pull request #3485 from dunxen/2024-12-cfgflagdualfunding
Reintroduce cfg(dual_funding) for handling of open_channel2 messages
2024-12-16 17:51:14 +00:00
Duncan Dean
76608f7c29
Modify release notes for PR 3137
We will not support accepting V2 channels in the v0.1 release, but
we do need to document the API change for push_msats -> channel_negotiation_type.
2024-12-16 06:07:05 +02:00
Jeffrey Czyz
09b134490a
Add pending changelog for PR 3435 2024-12-13 09:26:03 -06:00
shaavan
e4545257c9 Add ChangeLog 2024-12-11 23:00:33 +05:30
Valentine Wallace
2e685ffb24
Remove UserConfig::accept_mpp_keysend
This option was added to force users to opt into breaking compat with
< 0.0.116, so it should be fine to remove for the 0.1 release. Otherwise,
receiving to static invoices would always require flipping this on.
2024-12-04 15:57:20 -05:00
Duncan Dean
dd190ae785
Add pending release notes for accepting dual-funded channels 2024-11-20 14:04:18 +02:00
Matt Corallo
1c5b4c129b
Merge pull request #3355 from TheBlueMatt/2024-10-mon-ids-after-close 2024-11-14 21:53:52 +00:00
Matt Corallo
6f023f8f08 Req the counterparty node id when claiming against a closed chan
Currently we store in-flight `ChannelMonitorUpdate`s in the
per-peer structure in `ChannelManager`. This is nice and simple as
we're generally updating it when we're updating other per-peer
data, so we already have the relevant lock(s) and map entries.

Sadly, when we're claiming an HTLC against a closed channel, we
didn't have the `counterparty_node_id` available until it was
added in 0.0.124 (and now we only have it for HTLCs which were
forwarded in 0.0.124). This means we can't look up the per-peer
structure when claiming old HTLCs, making it difficult to track the
new `ChannelMonitorUpdate` as in-flight.

While we could transition the in-flight `ChannelMonitorUpdate`
tracking to a new global map indexed by `OutPoint`, doing so would
result in a major lock which would be highly contended across
channels with different peers.

Instead, as we move towards tracking in-flight
`ChannelMonitorUpdate`s for closed channels we'll keep our existing
storage, leaving only the `counterparty_node_id` issue to contend
with.

Here we simply accept the issue, requiring that
`counterparty_node_id` be available when claiming HTLCs against a
closed channel. On startup, we explicitly check for any forwarded
HTLCs which came from a closed channel where the forward happened
prior to 0.0.124, failing to deserialize, or logging an warning if
the channel is still open (implying things may work out, but panics
may occur if the channel closes prior to HTLC resolution).

While this is a somewhat dissapointing resolution, LDK nodes which
forward HTLCs are generally fairly well-upgraded, so it is not
anticipated to be an issue in practice.
2024-11-13 01:24:06 +00:00
Matt Corallo
b0bd4371d9
Merge pull request #3383 from valentinewallace/2024-09-blinded-keysend-verify
Verify blinded keysend payments
2024-11-12 15:00:46 +00:00
Valentine Wallace
02316d28f1
Remove pending_inbound_payments map from ChannelManager
LDK versions prior to 0.0.104 had stateful inbound payments written in this
map. In 0.0.104, we added support for stateless inbound payments with
deterministically generated payment secrets, and maintained deprecated support
for stateful inbound payments until 0.0.116. After 0.0.116, no further inbound
payments could have been written into this map.
2024-11-08 10:28:29 -05:00
Matt Corallo
ba264323f8 Doc the on-upgrade ChannelMonitor startup persistence semantics
Because the new startup `ChannelMonitor` persistence semantics rely
on new information stored in `ChannelMonitor` only for claims made
in the upgraded code, users upgrading from previous version of LDK
must apply the old `ChannelMonitor` persistence semantics at least
once (as the old code will be used to handle partial claims).
2024-10-24 17:44:33 +00:00
Matt Corallo
6c203d803e Stop relying on ChannelMonitor persistence after manager read
When we discover we've only partially claimed an MPP HTLC during
`ChannelManager` reading, we need to add the payment preimage to
all other `ChannelMonitor`s that were a part of the payment.

We previously did this with a direct call on the `ChannelMonitor`,
requiring users write the full `ChannelMonitor` to disk to ensure
that updated information made it.

This adds quite a bit of delay during initial startup - fully
resilvering each `ChannelMonitor` just to handle this one case is
incredibly excessive.

Over the past few commits we dropped the need to pass HTLCs
directly to the `ChannelMonitor`s using the background events to
provide `ChannelMonitorUpdate`s insetad.

Thus, here we finally drop the requirement to resilver
`ChannelMonitor`s on startup.
2024-10-24 17:44:33 +00:00
Matt Corallo
b8661ef6cf Pass info about claimed payments, incl HTLCs to ChannelMonitors
When we claim an MPP payment, then crash before persisting all the
relevant `ChannelMonitor`s, we rely on the payment data being
available in the `ChannelManager` on restart to re-claim any parts
that haven't yet been claimed. This is fine as long as the
`ChannelManager` was persisted before the `PaymentClaimable` event
was processed, which is generally the case in our
`lightning-background-processor`, but may not be in other cases or
in a somewhat rare race.

In order to fix this, we need to track where all the MPP parts of
a payment are in the `ChannelMonitor`, allowing us to re-claim any
missing pieces without reference to any `ChannelManager` data.

Further, in order to properly generate a `PaymentClaimed` event
against the re-started claim, we have to store various payment
metadata with the HTLC list as well.

Here we take the first step, building a list of MPP parts and
metadata in `ChannelManager` and passing it through to
`ChannelMonitor` in the `ChannelMonitorUpdate`s.
2024-10-24 17:44:33 +00:00
Duncan Dean
59f16896d6
Remove AvailableBalances::balance_msat
The ChannelMonitor::get_claimable_balances and ChainMonitor::get_claimable_balances
methods provide a more straightforward approach to the balance of a channel, which
satisfies most use cases. The computation of AvailableBalances::balance_msat is
complex and originally had a different purpose that is not applicable
anymore.

Co-authored-by: Willem Van Lint <noreply@wvanlint.dev>
2024-09-09 19:37:03 +02:00
Matt Corallo
f52148f4c2 Add an 0.0.124 CHANGELOG entry 2024-09-03 18:18:52 +00:00
Matt Corallo
3b70bd294c Add missing pending changelog for downgrade on unsafe funding 2024-08-27 19:31:25 +00:00
Duncan Dean
70762f90ca
Deprecate AvailableBalances::balance_msat
The ChannelMonitor::get_claimable_balances method provides a more
straightforward approach to the balance of a channel, which satisfies
most use cases. The computation of AvailableBalances::balance_msat is
complex and originally had a different purpose that is not applicable
anymore. We deprecate AvailableBalances::balance_msat now and will remove
it in a following release.

Co-authored-by: Willem Van Lint <noreply@wvanlint.dev>
2024-08-20 17:08:34 +02:00
Jeffrey Czyz
075a2e36b9
Make PaymentFailureReason downgradable
The PaymentFailureReason variants for invoice request failures will
cause downgrades to break. Instead, use a new TLV for the reason and
continue to write the old TLV, only use None for the new reasons.
2024-08-14 10:55:59 -05:00
Jeffrey Czyz
f00b782a1c
Add pending changelog for Event::PaymentFailed 2024-08-14 10:55:59 -05:00
Jeffrey Czyz
825bda03c9
Add pending changelog for BOLT12 authentication 2024-07-22 11:38:39 -05:00
Matt Corallo
1d1f47c45a Add pending changelog entry for the previous commit 2024-07-17 15:02:13 +00:00
Valentine Wallace
18ebbf7244
Make blinded hop features optional per spec.
The spec states that if these features are missing, we MUST process the message
as if it were present and contained an empty array.
2024-03-18 17:07:27 -04:00
Valentine Wallace
ef02b9e6f9
Fix ser for PaymentRelay and PaymentConstraints.
Two fields were serialized as u32/u64 when the spec said *tu32/tu64*.
/facepalm.
2024-03-14 15:26:11 -04:00
Matt Corallo
d6c16aa1ae Add CHANGELOG entries for 0.0.119 2023-12-15 23:53:40 +00:00
Valentine Wallace
ecd8238592
Add release note for blinded HTLC serialization. 2023-12-12 18:38:59 -05:00
Valentine Wallace
633be238fd
Fix skimmed fee ser in Channel
Previously, if some holding cell HTLCs have skimmed fees present and some
don't, we would fail to deserialize a Channel. See added test coverage.
2023-12-04 16:41:37 -05:00
Valentine Wallace
e510e3c2d9
Add release note for blinded HTLC backwards compat. 2023-11-29 22:46:54 -05:00
Elias Rohrer
c8ff32197a
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.
2023-11-23 09:30:56 +01:00
Matt Corallo
7a951b1bf7 Stop writing signer data as a part of channels
This breaks backwards compatibility with versions of LDK prior to
0.0.113 as they expect to always read signer data.

This also substantially reduces allocations during `ChannelManager`
serialization, as we currently don't pre-allocate the `Vec` that
the signer gets written in to. We could alternatively pre-allocate
that `Vec`, but we've been set up to skip the write entirely for a
while, and 0.0.113 was released nearly a year ago. Users
downgrading to LDK 0.0.112 and before at this point should not be
expected.
2023-11-09 22:28:08 +00:00
Matt Corallo
2587f70925 0.0.118 release notes 2023-10-23 23:41:11 +00:00
Matt Corallo
3133286c88 Add 0.0.117 release notes 2023-10-03 23:00:48 +00:00
Matt Corallo
c7c4226e99 Revert "Remove AvailableBalances::balance_msat"
While removing the `balance_msat` field absolutely makes sense -
it is, at best, confusing - we really need a solid replacement for
it before we can do so. While one such replacement is in progress,
it is not complete and we'd like to not block our current release
on its completion.

This reverts commit ef5be580f5.
2023-09-29 18:32:25 +00:00
Matt Corallo
47e1148283 Update remaining references to primary/secondary namespaces
Update various variables, error strings, and the pending changelog
entry to refer to new namespace terminology.
2023-09-28 18:35:38 +00:00
Dom Zippilli
0430d3379a Add MonitorUpdatingPersister
MonitorUpdatingPersister is an implementation of Persister that stores
ChannelMonitorUpdates separately from ChannelMonitors. Its RFC is
in #2545, at https://github.com/orgs/lightningdevkit/discussions/2545.

Co-Authored-By: Elias Rohrer <dev@tnull.de>
2023-09-26 16:30:07 -07:00
Valentine Wallace
070f7e0d5c
Support receiving to 1-hop blinded payment paths. 2023-09-12 18:11:59 -04:00
Antonio Yang
b1bedcfbec Rename SocketAddress from NetAddress 2023-09-08 20:42:06 +08:00
Matt Corallo
c60d3058af
Merge pull request #2371 from jkczyz/2023-06-offer-message-handling
BOLT 12 Invoice payments
2023-09-08 01:52:38 +00:00
Matt Corallo
2e113b549d
Merge pull request #2472 from tnull/2023-08-add-kvstore
Replace `KVStorePersister` with `KVStore`
2023-09-07 22:26:03 +00:00
Elias Rohrer
d1405f38bc
Add KVStore interface trait
We upstream the `KVStore` interface trait from LDK Node, which will
replace `KVStorePersister` in the coming commits.

Besides persistence, `KVStore` implementations will also offer to `list`
keys present in a given `namespace` and `read` the stored values.
2023-09-07 22:49:21 +02:00
Jeffrey Czyz
6d0c5f00ba
Add an InvoiceRequestFailed event
When an invoice is requested but either receives an error or never
receives a response, surface an event to indicate to the user that the
corresponding future payment has failed.
2023-09-07 11:08:53 -05:00
Elias Rohrer
61cf75265e
Have Route hold RouteParameters 2023-09-06 19:35:38 +02:00
optout
d5d336f215
Add ChannelId pending change note; formatting 2023-08-28 07:20:23 +02:00
Willem Van Lint
ef5be580f5 Remove AvailableBalances::balance_msat
The ChannelMonitor::get_claimable_balances method provides a more
straightforward approach to the balance of a channel, which satisfies
most use cases. The computation of AvailableBalances::balance_msat is
complex and originally had a different purpose that is not applicable
anymore.
2023-08-15 11:42:00 -07:00
Alec Chen
0a2dbdf247
Handle receiving custom HTLC TLVs
This completes basic receiver-side support for custom TLVs and adds
functional testing for sending and receiving.
2023-08-08 16:16:38 -05:00
Matt Corallo
b4a5de1d41 Add 0.0.116rc1 CHANGELOG entries (to be renamed 116 later) 2023-07-17 20:07:30 +00:00
Elias Rohrer
15b1c9b837
Merge pull request #2319 from valentinewallace/2023-05-forward-less-than-onion
Allow forwarding less than the amount in the onion
2023-06-21 09:25:07 +02:00
Valentine Wallace
27b99acd64
Add PaymentClaimable::counterparty_skimmed_fee_msat
See its docs
2023-06-20 17:57:38 -04:00
Valentine Wallace
52f290119d
Set extra skimmed fee on intercepted forward
Receivers need to use this value to verify incoming payments if
ChannelConfig::accept_underpaying_htlcs is set.
2023-06-20 17:57:38 -04:00
Matt Corallo
942d77699b Stop writing old user_payment_id field not read since 0.0.103
Since we're breaking downgrade compatibility to LDK version 0.0.103
and before, we might as well go ahead and remove other code we have
for compatibility.
2023-06-12 18:46:41 +00:00
Matt Corallo
6535627a3e Drop create_inbound_payment*_legacy breaking downgrade to 0.0.103
0.0.103 is now downright ancient, and certainly shouldn't exist in
production anywhere today. Thus, it seems fine to remove the
ability to create legacy stateful inbound payment entries.

Users downgrading to 0.0.103 will thus not be able to claim any
payments created on modern LDK, though we still retain the ability
to claim such payments at least for one more release.
2023-06-12 16:43:01 +00:00