Commit graph

5025 commits

Author SHA1 Message Date
Matt Corallo
2223e92ac6
Merge pull request #2110 from munjesi/docs_fixes
Replacing (C-not exported) in the docs
2023-03-27 18:12:00 +00:00
Jeffrey Czyz
dbf3d576b5
Merge pull request #2123 from benthecarman/create-inv-desc
Add generic InvoiceDescription to invoice in InvoiceBuilder
2023-03-24 15:00:10 -05:00
Matt Corallo
b72f6b1b84 Support future removal of redundant per-HTLC data in ChanMonUpds
`ChannelMonitorUpdate`s are our most size-sensitive objects - they
are the minimal objects which need to be written to disk on each
commitment update. Thus, we should be careful to ensure we don't
pack too much extraneous information into each one.

Here we add future support for removing the per-HTLC explicit
`Option<Signature>` and `HTLCInCommitmentUpdate` for non-dust HTLCs
in holder commitment tx updates, which are redundant with the
`HolderCommitmentTransaction`.

While we cannot remove them entirely as previous versions rely on
them, adding support for filling in the in-memory structures from
the redundant fields will let us remove them in a future version.

We also add test-only generation logic to test the new derivation.
2023-03-24 19:02:08 +00:00
benthecarman
18c3318b78
Add generic InvoiceDescription to invoice in InvoiceBuilder 2023-03-23 00:07:16 -05:00
Wilmer Paulino
174e16426a
Add new sub-module for BumpTransactionEvent
Its accompanying event handler will also live here.
2023-03-22 11:49:36 -07:00
Wilmer Paulino
ca9ca75f08
Move events.rs into its own top-level module
This is largely motivated by some follow-up work for anchors that will
introduce an event handler for `BumpTransaction` events, which we can
now include in this new top-level `events` module.
2023-03-22 11:49:33 -07:00
Jeffrey Czyz
3d479c9de6
Merge pull request #2114 from Evanfeenstra/force_close_msg_display
use PrintableString to Display CounterpartyForceClosed peer_msg
2023-03-22 12:32:22 -05:00
munjesi
b0bf50fa24 Replacing (C-not exported) in the docs 2023-03-22 14:30:36 +03:00
Evan Feenstra
987ab9512c SanitizedString struct to safely Display CounterpartyForceClosed peer_msg 2023-03-21 21:37:38 -07:00
Wilmer Paulino
04ee948643
Remove unused broadcast_latest_holder_commitment_txn method 2023-03-21 16:25:47 -07:00
Wilmer Paulino
00cfc6b823
Avoid refusing ChannelMonitorUpdates we expect to receive after closing
There is no need to fill the user's logs with errors that are expected
to be hit based on specific edge cases, like providing preimages after
a monitor has seen a confirmed commitment on-chain.

This doesn't really change our behavior – we still apply and persist the
state changes resulting from processing these updates regardless of
whether they succeed or not.
2023-03-21 16:25:47 -07:00
Wilmer Paulino
bd4eb0da76
Queue BackgroundEvent to force close channels upon ChannelManager::read
This results in a new, potentially redundant, `ChannelMonitorUpdate`
that must be applied to `ChannelMonitor`s to broadcast the holder's
latest commitment transaction.

This is a behavior change for anchor channels since their commitments
may require additional fees to be attached through a child anchor
transaction. Recall that anchor transactions are only generated by the
event consumer after processing a `BumpTransactionEvent::ChannelClose`
event, which is yielded after applying a
`ChannelMonitorUpdateStep::ChannelForceClosed` monitor update. Assuming
the node operator is not watching the mempool to generate these anchor
transactions without LDK, an anchor channel which we had to fail when
deserializing our `ChannelManager` would have its commitment transaction
broadcast by itself, potentially exposing the node operator to loss of
funds if the commitment transaction's fee is not enough to be accepted
into the network's mempools.
2023-03-21 16:25:46 -07:00
Wilmer Paulino
5a90f014f2
Use CLOSED_CHANNEL_UPDATE_ID in force closing ChannelMonitorUpdates
Currently, all that is required to force close a channel is to broadcast
either of the available commitment transactions, but this changes with
anchor outputs – commitment transactions may need to have
additional fees attached in order to confirm in a timely manner. While
we may be able to just queue a new update using the channel's next
available update ID, this may result in a violation of the
`ChannelMonitor` API (each update ID must strictly increase by 1) if the
channel had updates that were persisted by its `ChannelMonitor`, but not
the `ChannelManager`. Therefore, we choose to re-purpose the existing
`CLOSED_CHANNEL_UPDATE_ID` update ID to also apply to
`ChannelMonitorUpdate`s that will force close their respective channel
by broadcasting the holder's latest commitment transaction.
2023-03-21 16:25:45 -07:00
Matt Corallo
14ee173593
Merge pull request #2102 from douglaz/node_info_addresses
Remove NodeAnnouncementInfo addresses
2023-03-21 22:42:16 +00:00
Matt Corallo
9f8e832c7b
Merge pull request #2034 from wpaulino/anchor-revoked-aggregate-claim
Add test for aggregated revoked HTLC claim on anchors channel
2023-03-21 22:32:18 +00:00
Matt Corallo
ea15f0f448
Merge pull request #2100 from douglaz/docs_fixes
Docs improvements
2023-03-21 18:44:23 +00:00
Allan Douglas R. de Oliveira
6f5e5e3898 Remove redundant addresses field from NodeAnnouncementInfo
...replacing it with an acessor `addresses()`.

Besides removing a redundant data structure already present on inner
`NodeAnnouncement`, this change makes it possible to discover new address types
upon deserialization thanks to `UnsignedNodeAnnouncement`'s implementation.
2023-03-21 17:27:48 +00:00
Allan Douglas R. de Oliveira
963d6c4a51 Docs improvements 2023-03-21 14:11:13 +00:00
Wilmer Paulino
881656ba9e
Test anchors build in CI 2023-03-20 16:46:38 -07:00
Matt Corallo
85b573ddad Add an optional_vec TLV format which makes sense, unlike vec_type
`vec_type` is confusing - it is happy to have a missing entry,
"reading" an empty `Vec` instead, but always writes something,
making a serialization round-trip different.

This is a problem for writing a new `Vec` which is
backwards-incompatible, but only if filled in. In that case we'd
really like the same read behavior, but not write anything if the
`Vec` is empty. Here we introduce such semantics via a new
`optional_vec` TLV format.
2023-03-20 23:29:22 +00:00
Matt Corallo
1fdb052afc
Merge pull request #2118 from TheBlueMatt/2023-03-no-useless-strings
Remove unnecessary heap allocations in log-entry-matching tests
2023-03-20 22:22:56 +00:00
Matt Corallo
535dcc74b6 Remove unnecessary use in channelmonitor tests module 2023-03-20 20:08:29 +00:00
Matt Corallo
348e7274dc Remove unnecessary heap allocations in log-entry-matching tests 2023-03-20 20:07:18 +00:00
Wilmer Paulino
2cc48c5a3c
Add test for aggregated revoked HTLC claim on anchors channel 2023-03-20 11:32:15 -07:00
Wilmer Paulino
4be56b93b0
Maintain order of yielded claim events
Since the claim events are stored internally within a HashMap, they will
be yielded in a random order once dispatched. Claim events may be
invalidated if a conflicting claim has confirmed on-chain and we need to
generate a new claim event; the randomized order could result in the
new claim event being handled prior to the previous. To maintain the
order in which the claim events are generated, we track them in a Vec
instead and ensure only one instance of a PackageId only ever exists
within it.

This would have certain performance implications, but since we're
bounded by the total number of HTLCs in a commitment anyway, we're
comfortable with taking the cost.
2023-03-20 11:32:14 -07:00
Wilmer Paulino
7b9c28a021
Rename keys for OnchainTxHandler::claimable_outpoints map 2023-03-20 11:32:13 -07:00
Wilmer Paulino
1638c8b34a
Clarify OnchainEvent::Claim behavior
The previous documentation was slightly incorrect, a `Claim` can also be
from the counterparty if they happened to claim the same exact set of
outputs as a claiming transaction we generated.
2023-03-20 11:32:12 -07:00
Wilmer Paulino
7c446b4892
Add missing docs for BumpHTLCResolution 2023-03-20 11:32:09 -07:00
Wilmer Paulino
1958626744
Fix stale import behind anchors build tag 2023-03-20 11:32:07 -07:00
Wilmer Paulino
e7fb47b05a
Derive Eq on structs behind anchors build flag 2023-03-20 11:32:07 -07:00
Wilmer Paulino
cfa8941cc5
Implement PartialEq manually
Since we don't store `pending_claim_events` within `OnchainTxHandler` as
they'll be regenerated on restarts, we opt to implement `PartialEq`
manually such that the field is not longer considered.
2023-03-20 11:32:05 -07:00
Matt Corallo
86e94c4368
Merge pull request #2116 from TheBlueMatt/2023-03-serde-sucks
Drop `serde` dependency from `lightning-block-sync`
2023-03-20 18:31:12 +00:00
Matt Corallo
b701a6c516 Drop serde dependency from lightning-block-sync
`serde` doesn't bother with MSRVs, so its expected to break
frequently. Yesterday, the `derive` feature had its MSRV broken in
a patch version without care.

Luckily its trivial for us to remove the `serde` dependency in
`lightning-block-sync`, using only `serde_json` for the JSON
deserialization part. It even ends up net-negative on LoC.
2023-03-20 16:31:22 +00:00
Matt Corallo
48fa2fd172
Merge pull request #2024 from TheBlueMatt/2023-02-6conf-pub-hints
Include a route hint for public, not-yet-announced channels
2023-03-19 23:42:15 +00:00
Matt Corallo
cab6c976b6 Include a route hint for public, not-yet-announced channels
If we have a public channel which doesn't yet have six
confirmations the network can't possibly know about it as we cannot
have announced it yet. However, because we refuse to include
route-hints if we have any public channels, we will generate
invoices that no one can pay.

Thus, if we have any public, not-yet-announced channels, include
them as a route-hint.
2023-03-18 00:45:23 +00:00
Matt Corallo
217c3e09b3
Merge pull request #2107 from TheBlueMatt/2023-04-msrv-cleanup
Bump MSRV to 1.48 and replace most of CI with a bash script
2023-03-17 19:21:49 +00:00
Matt Corallo
6558b510cf Replace the bulk of CI with a (much simpler) bash script 2023-03-16 19:15:06 +00:00
Matt Corallo
12d799e6cb
Merge pull request #2094 from johncantrell97/expose-fee
expose `feerate_per_kw` in `ChannelDetails`
2023-03-15 21:16:23 +00:00
Matt Corallo
28cc71f980 Fix onion_message functional_tests no-std build 2023-03-15 19:19:49 +00:00
Matt Corallo
4e32de71df Remove build-features CI flag now that its always true 2023-03-15 18:18:08 +00:00
Matt Corallo
263173f06c Remove build-no-std CI flag now that its always true 2023-03-15 18:17:02 +00:00
Matt Corallo
fb4f34cb2c Remove build-net-tokio flag in CI since its now always true 2023-03-15 18:16:01 +00:00
Matt Corallo
11a0d266c5 Bump MSRV to 1.48
1.48.0 was released at the end of 2020, nearly 2.5 years ago. It
has been the rustc available on Debian stable since bullseye,
released in 2021. supporting Debian oldstable for more than a year
seems more than sufficient time to give Debian folks to upgrade,
and bullseye is set to become `oldstable` later this year with the
release of `bookworm`, likely this summer.

This also allows us to clean up our MSRV substantially, having a
single MSRV across our crates rather than a number of separate
ones. Sadly, windows already requires 1.49.
2023-03-15 18:11:43 +00:00
John Cantrell
d76b43fe44 expose feerate_sat_per_1000_weight in ChannelDetails
renames Channel::get_feerate to get_feerate_sat_per_1000_weight
2023-03-15 13:36:14 -04:00
Matt Corallo
2d213a47bf
Merge pull request #2045 from wpaulino/fix-broken-commitment-test-vectors
Update commitment test vectors
2023-03-14 19:01:59 +00:00
Matt Corallo
54f8895096
Merge pull request #2063 from valentinewallace/2023-03-remove-paymentpathfailed-retry
Remove `PaymentPathFailed::retry`
2023-03-13 23:01:38 +00:00
Matt Corallo
c18f7055cc
Merge pull request #2099 from tnull/2023-03-pin-ntapi-on-windows
Pin tokio to 1.26 on windows to fix CI
2023-03-13 17:44:08 +00:00
Matt Corallo
697f37dba6
Merge pull request #2091 from tnull/2023-03-expose-impl-writeable-tlv-based-enum-common 2023-03-13 16:32:19 +00:00
Valentine Wallace
f89b7d6fa9
Ensure payment_params present when checking is_retryable_now 2023-03-13 12:04:17 -04:00
Valentine Wallace
f6823c5541
Remove payment_params from send_payent_along_path
It's unused since it no longer inserts it into HTLCSource
2023-03-13 12:04:14 -04:00