Skip to content

Commit 2a642f8

Browse files
authored
Merge pull request #3536 from TheBlueMatt/2025-01-0.1-backports
Backports for 0.1.0
2 parents c8ec8eb + a016cc9 commit 2a642f8

32 files changed

+749
-227
lines changed

.github/workflows/build.yml

+28-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
platform: [ ubuntu-latest, windows-latest, macos-latest ]
21-
toolchain: [ stable, beta, 1.63.0 ] # 1.63.0 is the MSRV for all crates.
21+
toolchain: [ stable, beta, 1.63.0 ] # 1.63.0 is the MSRV for all crates but `lightning-transaction-sync`.
2222
exclude:
2323
- platform: windows-latest
2424
toolchain: 1.63.0
@@ -44,6 +44,27 @@ jobs:
4444
- name: Set RUSTFLAGS to deny warnings
4545
if: "matrix.toolchain == '1.63.0'"
4646
run: echo "RUSTFLAGS=-D warnings" >> "$GITHUB_ENV"
47+
- name: Run CI script
48+
shell: bash # Default on Winblows is powershell
49+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh
50+
51+
build-tx-sync:
52+
strategy:
53+
fail-fast: false
54+
matrix:
55+
platform: [ ubuntu-latest, macos-latest ]
56+
toolchain: [ stable, beta, 1.75.0 ] # 1.75.0 is the MSRV for `lightning-transaction-sync`.
57+
runs-on: ${{ matrix.platform }}
58+
steps:
59+
- name: Checkout source code
60+
uses: actions/checkout@v4
61+
- name: Install Rust ${{ matrix.toolchain }} toolchain
62+
run: |
63+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ matrix.toolchain }}
64+
rustup override set ${{ matrix.toolchain }}
65+
- name: Set RUSTFLAGS to deny warnings
66+
if: "matrix.toolchain == '1.75.0'"
67+
run: echo "RUSTFLAGS=-D warnings" >> "$GITHUB_ENV"
4768
- name: Enable caching for bitcoind
4869
id: cache-bitcoind
4970
uses: actions/cache@v4
@@ -57,7 +78,7 @@ jobs:
5778
path: bin/electrs-${{ runner.os }}-${{ runner.arch }}
5879
key: electrs-${{ runner.os }}-${{ runner.arch }}
5980
- name: Download bitcoind/electrs
60-
if: "matrix.platform != 'windows-latest' && (steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true')"
81+
if: "steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true'"
6182
run: |
6283
source ./contrib/download_bitcoind_electrs.sh
6384
mkdir bin
@@ -69,7 +90,7 @@ jobs:
6990
echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"
7091
- name: Run CI script
7192
shell: bash # Default on Winblows is powershell
72-
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh
93+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tx-sync-tests.sh
7394

7495
coverage:
7596
strategy:
@@ -229,7 +250,10 @@ jobs:
229250
run: |
230251
cd fuzz && cargo update -p regex --precise "1.9.6" --verbose && cd ..
231252
- name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
232-
run: cd fuzz && RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always
253+
run: |
254+
cd fuzz
255+
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always
256+
cargo clean
233257
- name: Run fuzzers
234258
run: cd fuzz && ./ci-fuzz.sh && cd ..
235259

CHANGELOG.md

+174
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,177 @@
1+
# 0.1 - Jan XXX, 2025 - XXX
2+
3+
## API Updates
4+
* The `lightning-liquidity` crate has been moved into the `rust-lightning`
5+
git tree, enabling support for both sides of the LSPS channel open
6+
negotiation protocols (#3436).
7+
* Since its last alpha release, `lightning-liquidity` has also gained support
8+
for acting as an LSPS1 client (#3436).
9+
* This release includes support for BIP 353 Human Readable Names resolution.
10+
With the `dnssec` feature enabled, simply call `ChannelManager`'s
11+
`pay_for_offer_from_human_readable_name` with a list of lightning nodes that
12+
have the `dns_resolver` feature flag set (e.g. those running LDK with the
13+
new `lightning_dns_resolver::OMDomainResolver` set up to resolve DNS queries
14+
for others) and a Human Readable Name (#3346, #3179, #3283).
15+
* Asynchronous `ChannelMonitorUpdate` persistence (i.e. the use of
16+
`ChannelMonitorUpdateStatus::InProgress`) is now considered beta-quality.
17+
There are no known issues with it, though the likelihood of unknown issues
18+
is high (#3414).
19+
* `ChannelManager`'s `send_payment_with_route` and `send_spontaneous_payment`
20+
were removed. Use `send_payment` and `send_spontaneous_payment_with_retry`
21+
(now renamed `send_spontaneous_payment`) instead (#3430).
22+
* `ChannelMonitor`s no longer need to be re-persisted after deserializing the
23+
`ChannelManager` before beginning normal operation. As such,
24+
`ChannelManagerReadArgs::channel_monitors` no longer requires mutable
25+
references (#3322). See the Backwards Compatibility section for more info.
26+
* Additional information is now stored in `ChannelMonitorUpdate`s which may
27+
increase the average size of `ChannelMonitorUpdate`s when claiming inbound
28+
payments substantially. The expected maximum size of `ChannelMonitorUpdate`s
29+
shouldn't change materially (#3322).
30+
* Redundant `Event::PaymentClaimed`s will be generated more frequently on
31+
startup compared to previous versions.
32+
`Event::PaymentClaim{able,ed}::payment_id` has been added to allow for more
33+
robust handling of redundant events on payments with duplicate
34+
`PaymentHash`es (#3303, #3322).
35+
* `ChannelMonitorUpdate::update_id`s no longer have a magic value (of
36+
`u64::MAX`) for updates after a channel has been closed. They are now
37+
always monotonically increasing (#3355).
38+
* The MSRV of `lightning-transaction-sync` has been increased to rustc 1.75 due
39+
to its HTTP client dependencies (#3528).
40+
* The default `ProbabilisticScoringFeeParameters` values now recommend specific
41+
ratios between different penalties, and default penalties now allow for
42+
higher fees in order to reduce payment latency (#3495).
43+
* On-chain state resolution now more aggressively batches claims into single
44+
transactions, reducing on-chain fee costs when resolving multiple HTLCs for a
45+
single channel force-closure. This also reduces the on-chain reserve
46+
requirements for nodes using anchor channels (#3340).
47+
* A `MigratableKVStore` trait was added (and implemented for
48+
`FilesystemStore`), enabling easy migration between `KVStore`s (#3481).
49+
* `InvoiceRequest::amount_msats` now returns the `offer`-implied amount if a
50+
Bitcoin-denominated amount was set in the `offer` and no amount was set
51+
directly in the `invoice_request` (#3535).
52+
* `Event::OpenChannelRequest::push_msat` has been replaced with an enum in
53+
preparation for the dual-funding protocol coming in a future release (#3137).
54+
* `GossipVerifier` now requires a `P2PGossipSync` which holds a reference to
55+
the `GossipVerifier` via an `Arc` (#3432).
56+
* The `max_level_*` features were removed as the performance gain compared to
57+
doing the limiting at runtime was negligible (#3431).
58+
* `ChannelManager::create_bolt11_invoice` was added, deprecating the
59+
`lightning::ln::invoice_utils` module (#3389).
60+
* The `bech32` dependency has been upgraded to 0.11 across crates (#3270).
61+
* Support for creating BOLT 12 `invoice_request`s with a static signing key
62+
rather than an ephemeral one has been removed (#3264).
63+
* The `Router` trait no longer extends the `MessageRouter` trait, creating an
64+
extra argument to `ChannelManager` construction (#3326).
65+
* The deprecated `AvailableBalances::balance_msat` has been removed in favor of
66+
`ChannelMonitor::get_claimable_balances` (#3243).
67+
* Deprecated re-exports of `Payment{Hash,Preimage,Secret}` and `features` were
68+
removed (#3359).
69+
* `bolt11_payment::*_from_zero_amount_invoice` methods were renamed
70+
`*_from_variable_amount_invoice` (#3397)
71+
* Offer `signing_pubkey` (and related struct names) have been renamed
72+
`issuer_signing_pubkey` (#3218).
73+
* `Event::PaymentForwarded::{prev,next}_node_id` were added (#3458).
74+
* `Event::ChannelClosed::last_local_balance_msat` was added (#3235).
75+
* `RoutingMessageHandler::handle_*` now all have a `node_id` argument (#3291).
76+
* `lightning::util::persist::MonitorName` has been exposed (#3376).
77+
* `ProbabilisticScorer::live_estimated_payment_success_probability` was added
78+
(#3420)
79+
* `EcdsaChannelSigner::sign_splicing_funding_input` was added to support an
80+
eventual splicing feature (#3316).
81+
* `{Payment,Offer}Id` now support lowercase-hex formatting (#3377).
82+
83+
## Bug Fixes
84+
* Fixed a rare case where a BOLT 12 payment may be made duplicatively if the
85+
node crashes while processing a BOLT 12 `invoice` message (#3313).
86+
* Fixed a bug where a malicious sender could cause a payment `Event` to be
87+
generated with an `OfferId` using a payment with a lower amount than the
88+
corresponding BOLT 12 offer would have required. The amount in the
89+
`Event::Payment{Claimable,Claimed}` were still correct (#3435).
90+
* The `ProbabilisticScorer` model and associated default scoring parameters
91+
were tweaked to be more predictive of real-world results (#3368, #3495).
92+
* `ProbabilisticScoringFeeParameters::base_penalty_amount_multiplier_msat` no
93+
longer includes any pending HTLCs we already have through channels in the
94+
graph, avoiding over-penalizing them in comparison to other channels (#3356).
95+
* A `ChannelMonitor` will no longer be archived if a `MonitorEvent` containing
96+
a preimage for another channel is pending. This fixes an issue where a
97+
payment preimage needed for another channel claim is lost if events go
98+
un-processed for 4038 blocks (#3450).
99+
* `std` builds no longer send the full gossip state to peers that do not
100+
request it (#3390).
101+
* `lightning-block-sync` listeners now receive `block_connected` calls, rather
102+
than always receiving `filtered_block_connected` calls (#3354).
103+
* Fixed a bug where some transactions were broadcasted one block before their
104+
locktime made them candidates for inclusion in the mempool (though they would
105+
be automatically re-broadcasted later, #3453).
106+
* `ChainMonitor` now persists `ChannelMonitor`s when their `Balance` set first
107+
goes empty, making `ChannelMonitor` pruning more reliable on nodes that are
108+
only online briefly (e.g. mobile nodes, #3442).
109+
* BOLT 12 invoice requests now better handle intermittent internet connectivity
110+
(e.g. on mobile devices with app interruptions, #3010).
111+
* Broadcast-gossip `MessageSendEvent`s from the `ChannelMessageHandler` are now
112+
delivered to peers even if the peer is behind in processing relayed gossip.
113+
This ensures our own gossip propagates well even if we have very limited
114+
upload bandwidth (#3142).
115+
* Fixed a bug where calling `OutputSweeper::transactions_confirmed` with
116+
transactions from anything but the latest block may have triggered a spurious
117+
assertion in debug mode (#3524).
118+
119+
## Performance Improvements
120+
* LDK now verifies `channel_update` gossip messages without holding a lock,
121+
allowing additional parallelism during gossip sync (#3310).
122+
* LDK now checks if it already has certain gossip messages before verifying the
123+
message signatures, reducing CPU usage during gossip sync after the first
124+
startup (#3305).
125+
126+
## Node Compatibility
127+
* LDK now handles fields in the experimental range of BOLT 12 messages (#3237).
128+
129+
## Backwards Compatibility
130+
* Nodes with pending forwarded HTLCs or unclaimed payments cannot be
131+
upgraded directly from 0.0.123 or earlier to 0.1. Instead, they must
132+
first either resolve all pending HTLCs (including those pending
133+
resolution on-chain), or run 0.0.124 or 0.0.125 and resolve any HTLCs that
134+
were originally forwarded or received running 0.0.123 or earlier (#3355).
135+
* `ChannelMonitor`s not being re-persisted after deserializing the
136+
`ChannelManager` only applies to upgraded nodes *after* a startup with the
137+
old semantics completes at least once. In other words, you must deserialize
138+
the `ChannelManager` with an upgraded LDK, persist the `ChannelMonitor`s as
139+
you would on pre-0.1 versions of LDK, then continue to normal startup once,
140+
and for startups thereafter you can take advantage of the new semantics
141+
avoiding redundant persistence on startup (#3322).
142+
* Pending inbound payments paying a BOLT 12 `invoice` issued prior to upgrade
143+
to LDK 0.1 will fail. Issued BOLT 12 `offer`s remain payable (#3435).
144+
* `UserConfig::accept_mpp_keysend` was removed, thus the presence of pending
145+
inbound MPP keysend payments will prevent downgrade to LDK 0.0.115 and
146+
earlier (#3439).
147+
* Inbound payments initialized using the removed
148+
`ChannelManager::create_inbound_payment{,_for_hash}_legacy` API will no
149+
longer be accepted by LDK 0.1 (#3383).
150+
* Downgrading to prior versions of LDK after using `ChannelManager`'s
151+
`unsafe_manual_funding_transaction_generated` may cause `ChannelManager`
152+
deserialization to fail (#3259).
153+
* `ChannelDetails` serialized with LDK 0.1+ read with versions prior to 0.1
154+
will have `balance_msat` equal to `next_outbound_htlc_limit_msat` (#3243).
155+
156+
## Security
157+
0.1 fixes a funds-theft vulnerability when paying BOLT 12 offers as well as a
158+
funds-lockup denial-of-service issue for anchor channels.
159+
* When paying a BOLT 12 offer, if the recipient responds to our
160+
`invoice_request` with an `invoice` which had an amount different from the
161+
amount we intended to pay (either from the `offer` or the `amount_msats`
162+
passed to `ChannelManager::pay_for_offer`), LDK would pay the amount from the
163+
`invoice`. As a result, a malicious recipient could cause us to overpay the
164+
amount we intended to pay (#3535).
165+
* Fixed a bug where a counterparty can cause funds of ours to be locked up
166+
by broadcasting a revoked commitment transaction and following HTLC
167+
transactions in specific formats when using an anchor channel. The funds can
168+
be recovered by upgrading to 0.1 and replaying the counterparty's broadcasted
169+
transactions (using `Confirm::transactions_confirmed`) (#3537). Thanks to
170+
Matt Morehouse for reporting and fixing this issue.
171+
* Various denial-of-service issues in the formerly-alpha `lightning-liquidity`
172+
crate have been addressed (#3436, #3493).
173+
174+
1175
# 0.0.125 - Oct 14, 2024 - "Delayed Beta Testing"
2176

3177
## Bug Fixes

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ members = [
1313
"lightning-background-processor",
1414
"lightning-rapid-gossip-sync",
1515
"lightning-custom-message",
16-
"lightning-transaction-sync",
1716
"lightning-macros",
1817
"lightning-dns-resolver",
1918
"lightning-liquidity",
2019
"possiblyrandom",
2120
]
2221

2322
exclude = [
23+
"lightning-transaction-sync",
2424
"no-std-check",
2525
"msrv-no-dev-deps-check",
2626
"bench",

ci/check-lint.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,5 @@ RUSTFLAGS='-D warnings' cargo clippy -- \
9393
-A clippy::unnecessary_to_owned \
9494
-A clippy::unnecessary_unwrap \
9595
-A clippy::unused_unit \
96-
-A clippy::useless_conversion
96+
-A clippy::useless_conversion \
97+
-A clippy::unnecessary_map_or `# to be removed once we hit MSRV 1.70`

ci/ci-tests.sh

+2-39
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
set -eox pipefail
33

44
RUSTC_MINOR_VERSION=$(rustc --version | awk '{ split($2,a,"."); print a[2] }')
5-
HOST_PLATFORM="$(rustc --version --verbose | grep "host:" | awk '{ print $2 }')"
65

76
# Some crates require pinning to meet our MSRV even for our downstream users,
87
# which we do here.
@@ -11,19 +10,6 @@ function PIN_RELEASE_DEPS {
1110
# Starting with version 1.39.0, the `tokio` crate has an MSRV of rustc 1.70.0
1211
[ "$RUSTC_MINOR_VERSION" -lt 70 ] && cargo update -p tokio --precise "1.38.1" --verbose
1312

14-
# Starting with version 0.7.12, the `tokio-util` crate has an MSRV of rustc 1.70.0
15-
[ "$RUSTC_MINOR_VERSION" -lt 70 ] && cargo update -p tokio-util --precise "0.7.11" --verbose
16-
17-
# url 2.5.3 switched to idna 1.0.3 and ICU4X, which requires rustc 1.67 or newer.
18-
# Here we opt to keep using unicode-rs by pinning idna_adapter as described here: https://docs.rs/crate/idna_adapter/1.2.0
19-
[ "$RUSTC_MINOR_VERSION" -lt 67 ] && cargo update -p idna_adapter --precise "1.1.0" --verbose
20-
21-
# indexmap 2.6.0 upgraded to hashbrown 0.15, which unfortunately bumped their MSRV to rustc 1.65 with the 0.15.1 release (and 2.7.0 was released since).
22-
[ "$RUSTC_MINOR_VERSION" -lt 65 ] && cargo update -p indexmap@2.7.0 --precise "2.5.0" --verbose
23-
24-
# Starting with version 0.23.20, the `rustls` crate has an MSRV of rustc 1.71.0
25-
[ "$RUSTC_MINOR_VERSION" -lt 71 ] && cargo update -p rustls@0.23.20 --precise "0.23.19" --verbose
26-
2713
return 0 # Don't fail the script if our rustc is higher than the last check
2814
}
2915

@@ -35,15 +21,12 @@ PIN_RELEASE_DEPS # pin the release dependencies in our main workspace
3521
# The addr2line v0.21 crate (a dependency of `backtrace` starting with 0.3.69) relies on rustc 1.65
3622
[ "$RUSTC_MINOR_VERSION" -lt 65 ] && cargo update -p backtrace --precise "0.3.68" --verbose
3723

38-
# Starting with version 0.5.9 (there is no .6-.8), the `home` crate has an MSRV of rustc 1.70.0.
39-
[ "$RUSTC_MINOR_VERSION" -lt 70 ] && cargo update -p home --precise "0.5.5" --verbose
40-
4124
# proptest 1.3.0 requires rustc 1.64.0
4225
[ "$RUSTC_MINOR_VERSION" -lt 64 ] && cargo update -p proptest --precise "1.2.0" --verbose
4326

4427
export RUST_BACKTRACE=1
4528

46-
echo -e "\n\nChecking the full workspace."
29+
echo -e "\n\nChecking the workspace, except lightning-transaction-sync."
4730
cargo check --verbose --color always
4831

4932
# When the workspace members change, make sure to update the list here as well
@@ -58,7 +41,6 @@ WORKSPACE_MEMBERS=(
5841
lightning-background-processor
5942
lightning-rapid-gossip-sync
6043
lightning-custom-message
61-
lightning-transaction-sync
6244
lightning-macros
6345
lightning-dns-resolver
6446
lightning-liquidity
@@ -83,25 +65,6 @@ cargo check -p lightning-block-sync --verbose --color always --features rpc-clie
8365
cargo test -p lightning-block-sync --verbose --color always --features rpc-client,rest-client,tokio
8466
cargo check -p lightning-block-sync --verbose --color always --features rpc-client,rest-client,tokio
8567

86-
if [[ "$HOST_PLATFORM" != *windows* ]]; then
87-
echo -e "\n\nChecking Transaction Sync Clients with features."
88-
cargo check -p lightning-transaction-sync --verbose --color always --features esplora-blocking
89-
cargo check -p lightning-transaction-sync --verbose --color always --features esplora-async
90-
cargo check -p lightning-transaction-sync --verbose --color always --features esplora-async-https
91-
cargo check -p lightning-transaction-sync --verbose --color always --features electrum
92-
93-
if [ -z "$CI_ENV" ] && [[ -z "$BITCOIND_EXE" || -z "$ELECTRS_EXE" ]]; then
94-
echo -e "\n\nSkipping testing Transaction Sync Clients due to BITCOIND_EXE or ELECTRS_EXE being unset."
95-
cargo check -p lightning-transaction-sync --tests
96-
else
97-
echo -e "\n\nTesting Transaction Sync Clients with features."
98-
cargo test -p lightning-transaction-sync --verbose --color always --features esplora-blocking
99-
cargo test -p lightning-transaction-sync --verbose --color always --features esplora-async
100-
cargo test -p lightning-transaction-sync --verbose --color always --features esplora-async-https
101-
cargo test -p lightning-transaction-sync --verbose --color always --features electrum
102-
fi
103-
fi
104-
10568
echo -e "\n\nTest futures builds"
10669
cargo test -p lightning-background-processor --verbose --color always --features futures
10770
cargo test -p lightning-background-processor --verbose --color always --features futures --no-default-features
@@ -145,7 +108,7 @@ cargo test -p lightning-invoice --verbose --color always --no-default-features -
145108
echo -e "\n\nTesting no_std build on a downstream no-std crate"
146109
# check no-std compatibility across dependencies
147110
pushd no-std-check
148-
cargo check --verbose --color always --features lightning-transaction-sync
111+
cargo check --verbose --color always
149112
[ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
150113
popd
151114

0 commit comments

Comments
 (0)