Skip to content

Commit 528b611

Browse files
committed
Bump LDK to 0.3.0-beta1
Track the first LDK 0.3 beta and its matching payment-instructions revision. Preserve Esplora configuration across the client versions and expose splice negotiation only to local contributors, as defined by the beta API. Co-Authored-By: HAL 9000
1 parent abbed3e commit 528b611

5 files changed

Lines changed: 37 additions & 35 deletions

File tree

Cargo.toml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ postgres = ["dep:tokio-postgres", "dep:native-tls", "dep:postgres-native-tls"]
4141
#lightning-macros = { version = "0.2.0" }
4242
#lightning-dns-resolver = { version = "0.3.0" }
4343

44-
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "506cb91f2e0fb87906188b79777bcf42595d3623", features = ["std"] }
45-
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "506cb91f2e0fb87906188b79777bcf42595d3623" }
46-
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "506cb91f2e0fb87906188b79777bcf42595d3623", features = ["std"] }
47-
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "506cb91f2e0fb87906188b79777bcf42595d3623" }
48-
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "506cb91f2e0fb87906188b79777bcf42595d3623", features = ["tokio"] }
49-
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "506cb91f2e0fb87906188b79777bcf42595d3623" }
50-
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "506cb91f2e0fb87906188b79777bcf42595d3623" }
51-
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "506cb91f2e0fb87906188b79777bcf42595d3623", features = ["rest-client", "rpc-client", "tokio"] }
52-
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "506cb91f2e0fb87906188b79777bcf42595d3623", features = ["esplora-async-https", "time", "electrum-rustls-ring"] }
53-
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "506cb91f2e0fb87906188b79777bcf42595d3623", features = ["std"] }
54-
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "506cb91f2e0fb87906188b79777bcf42595d3623" }
55-
lightning-dns-resolver = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "506cb91f2e0fb87906188b79777bcf42595d3623" }
44+
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "9174965af9437196c527a9aa0df36bbcf050c8bb", features = ["std"] }
45+
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "9174965af9437196c527a9aa0df36bbcf050c8bb" }
46+
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "9174965af9437196c527a9aa0df36bbcf050c8bb", features = ["std"] }
47+
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "9174965af9437196c527a9aa0df36bbcf050c8bb" }
48+
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "9174965af9437196c527a9aa0df36bbcf050c8bb", features = ["tokio"] }
49+
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "9174965af9437196c527a9aa0df36bbcf050c8bb" }
50+
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "9174965af9437196c527a9aa0df36bbcf050c8bb" }
51+
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "9174965af9437196c527a9aa0df36bbcf050c8bb", features = ["rest-client", "rpc-client", "tokio"] }
52+
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "9174965af9437196c527a9aa0df36bbcf050c8bb", features = ["esplora-async-https", "time", "electrum-rustls-ring"] }
53+
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "9174965af9437196c527a9aa0df36bbcf050c8bb", features = ["std"] }
54+
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "9174965af9437196c527a9aa0df36bbcf050c8bb" }
55+
lightning-dns-resolver = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "9174965af9437196c527a9aa0df36bbcf050c8bb" }
5656

5757
bdk_chain = { version = "0.23.3", default-features = false, features = ["std"] }
5858
bdk_esplora = { version = "0.22.2", default-features = false, features = ["async-https-rustls", "tokio"]}
@@ -71,6 +71,7 @@ getrandom = { version = "0.3", default-features = false }
7171
chrono = { version = "0.4", default-features = false, features = ["clock"] }
7272
tokio = { version = "1.39", default-features = false, features = [ "rt-multi-thread", "time", "sync", "macros", "net" ] }
7373
esplora-client = { version = "0.12", default-features = false, features = ["tokio", "async-https-rustls"] }
74+
ldk-esplora-client = { package = "esplora-client", version = "0.13", default-features = false, features = ["tokio", "async-https-rustls"] }
7475
electrum-client = { version = "0.25", default-features = false, features = ["proxy", "use-rustls-ring"] }
7576
libc = "0.2"
7677
uniffi = { version = "0.29.5", features = ["build"], optional = true }
@@ -85,14 +86,14 @@ postgres-native-tls = { version = "0.5", default-features = false, features = ["
8586
vss-client = { package = "vss-client-ng", version = "0.6" }
8687
prost = { version = "0.11.6", default-features = false}
8788
#bitcoin-payment-instructions = { version = "0.6" }
88-
bitcoin-payment-instructions = { git = "https://github.com/tnull/bitcoin-payment-instructions", rev = "0e430be98c09540624a68a68022ee0551e86d1be" }
89+
bitcoin-payment-instructions = { git = "https://github.com/tnull/bitcoin-payment-instructions", rev = "1d6ffaa8962391ddc84aeef98bd7439e55ccae9d" }
8990

9091
[target.'cfg(windows)'.dependencies]
9192
winapi = { version = "0.3", features = ["winbase"] }
9293

9394
[dev-dependencies]
94-
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "506cb91f2e0fb87906188b79777bcf42595d3623", features = ["std", "_test_utils"] }
95-
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "506cb91f2e0fb87906188b79777bcf42595d3623", features = ["tokio"] }
95+
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "9174965af9437196c527a9aa0df36bbcf050c8bb", features = ["std", "_test_utils"] }
96+
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "9174965af9437196c527a9aa0df36bbcf050c8bb", features = ["tokio"] }
9697
rand = { version = "0.9.2", default-features = false, features = ["std", "thread_rng", "os_rng"] }
9798
proptest = "1.0.0"
9899
regex = "1.5.6"

src/chain/esplora.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,24 @@ impl EsploraChainSource {
5656
let mut client_builder = esplora_client::Builder::new(&server_url);
5757
client_builder =
5858
client_builder.timeout(sync_config.timeouts_config.per_request_timeout_secs as u64);
59+
let mut ldk_client_builder = ldk_esplora_client::Builder::new(&server_url);
60+
ldk_client_builder = ldk_client_builder.timeout(Duration::from_secs(
61+
sync_config.timeouts_config.per_request_timeout_secs as u64,
62+
));
5963

6064
for (header_name, header_value) in &headers {
6165
client_builder = client_builder.header(header_name, header_value);
66+
ldk_client_builder = ldk_client_builder.header(header_name, header_value);
6267
}
6368

6469
let esplora_client = client_builder.build_async().map_err(|e| {
6570
log_error!(logger, "Failed to build Esplora client: {}", e);
6671
})?;
72+
let ldk_esplora_client = ldk_client_builder.build_async().map_err(|e| {
73+
log_error!(logger, "Failed to build LDK Esplora client: {}", e);
74+
})?;
6775
let tx_sync =
68-
Arc::new(EsploraSyncClient::from_client(esplora_client.clone(), Arc::clone(&logger)));
76+
Arc::new(EsploraSyncClient::from_client(ldk_esplora_client, Arc::clone(&logger)));
6977

7078
let onchain_wallet_sync_status = Mutex::new(WalletSyncStatus::Completed);
7179
let lightning_wallet_sync_status = Mutex::new(WalletSyncStatus::Completed);

src/event.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,10 @@ pub enum Event {
271271
/// This will be `None` for events serialized by LDK Node v0.2.1 and prior.
272272
reason: Option<ClosureReason>,
273273
},
274-
/// A channel splice has been negotiated and the funding transaction is pending
275-
/// confirmation on-chain.
274+
/// A channel splice with local inputs or outputs has been negotiated and the funding
275+
/// transaction is pending confirmation on-chain.
276+
///
277+
/// This event is not emitted when only the counterparty contributes to a splice.
276278
SpliceNegotiated {
277279
/// The `channel_id` of the channel.
278280
channel_id: ChannelId,
@@ -1500,7 +1502,7 @@ where
15001502
from_prev_str,
15011503
next_htlcs.len(),
15021504
to_next_str,
1503-
outbound_amount_forwarded_msat.unwrap_or(0),
1505+
outbound_amount_forwarded_msat,
15041506
fee_earned,
15051507
);
15061508
} else {
@@ -1511,7 +1513,7 @@ where
15111513
from_prev_str,
15121514
next_htlcs.len(),
15131515
to_next_str,
1514-
outbound_amount_forwarded_msat.unwrap_or(0),
1516+
outbound_amount_forwarded_msat,
15151517
fee_earned,
15161518
);
15171519
}
@@ -1545,7 +1547,7 @@ where
15451547
total_fee_earned_msat,
15461548
skimmed_fee_msat,
15471549
claim_from_onchain_tx,
1548-
outbound_amount_forwarded_msat,
1550+
outbound_amount_forwarded_msat: Some(outbound_amount_forwarded_msat),
15491551
};
15501552
self.event_queue.add_event(event).await.map_err(|e| {
15511553
log_error!(self.logger, "Failed to push to event queue: {}", e);

tests/common/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,6 @@ pub async fn splice_in_with_all(
10631063
node_a.splice_in_with_all(user_channel_id, node_b.node_id()).unwrap();
10641064

10651065
let splice_txo = expect_splice_negotiated_event!(node_a, node_b.node_id());
1066-
expect_splice_negotiated_event!(node_b, node_a.node_id());
10671066
wait_for_tx(&electrsd.client, splice_txo.txid).await;
10681067
}
10691068

@@ -1537,7 +1536,6 @@ pub(crate) async fn do_channel_full_cycle<E: ElectrumApi>(
15371536
assert!(splice_out_sat > 500_000);
15381537
node_b.splice_out(&user_channel_id_b, node_a.node_id(), &addr_a, splice_out_sat).unwrap();
15391538

1540-
expect_splice_negotiated_event!(node_a, node_b.node_id());
15411539
expect_splice_negotiated_event!(node_b, node_a.node_id());
15421540

15431541
generate_blocks_and_wait(&bitcoind, electrsd, 6).await;
@@ -1560,7 +1558,6 @@ pub(crate) async fn do_channel_full_cycle<E: ElectrumApi>(
15601558
node_a.splice_in(&user_channel_id_a, node_b.node_id(), splice_in_sat).unwrap();
15611559

15621560
expect_splice_negotiated_event!(node_a, node_b.node_id());
1563-
expect_splice_negotiated_event!(node_b, node_a.node_id());
15641561

15651562
generate_blocks_and_wait(&bitcoind, electrsd, 6).await;
15661563
node_a.sync_wallets().unwrap();

tests/integration_tests_rust.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,8 +1752,7 @@ async fn splice_channel() {
17521752
// Splice-in funds for Node B so that it has outbound liquidity to make a payment
17531753
node_b.splice_in(&user_channel_id_b, node_a.node_id(), 4_000_000).unwrap();
17541754

1755-
let txo = expect_splice_negotiated_event!(node_a, node_b.node_id());
1756-
expect_splice_negotiated_event!(node_b, node_a.node_id());
1755+
let txo = expect_splice_negotiated_event!(node_b, node_a.node_id());
17571756

17581757
// Node B contributed to this splice, so wait for its funding broadcast to be classified before
17591758
// syncing — otherwise a sync racing the broadcaster's queue records a generic on-chain payment.
@@ -1813,7 +1812,6 @@ async fn splice_channel() {
18131812
node_a.splice_out(&user_channel_id_a, node_b.node_id(), &address, amount_msat / 1000).unwrap();
18141813

18151814
let txo = expect_splice_negotiated_event!(node_a, node_b.node_id());
1816-
expect_splice_negotiated_event!(node_b, node_a.node_id());
18171815

18181816
// Node A contributed to this splice, so wait for its funding broadcast to be classified before
18191817
// syncing — otherwise a sync racing the broadcaster's queue records a generic on-chain payment.
@@ -1926,8 +1924,7 @@ async fn run_rbf_splice_channel_test(confirm_original: bool) {
19261924
// Initiate a splice-in to create a pending splice
19271925
node_b.splice_in(&user_channel_id_b, node_a.node_id(), 1_000_000).unwrap();
19281926

1929-
let original_txo = expect_splice_negotiated_event!(node_a, node_b.node_id());
1930-
expect_splice_negotiated_event!(node_b, node_a.node_id());
1927+
let original_txo = expect_splice_negotiated_event!(node_b, node_a.node_id());
19311928

19321929
// Sync so the original splice candidate is recorded as a canonical wallet transaction before
19331930
// the RBF below replaces it. The post-RBF sync then observes the original candidate being
@@ -1964,8 +1961,7 @@ async fn run_rbf_splice_channel_test(confirm_original: bool) {
19641961
// bump_channel_funding_fee should succeed when there's a pending splice
19651962
node_b.bump_channel_funding_fee(&user_channel_id_b, node_a.node_id()).unwrap();
19661963

1967-
let rbf_txo = expect_splice_negotiated_event!(node_a, node_b.node_id());
1968-
expect_splice_negotiated_event!(node_b, node_a.node_id());
1964+
let rbf_txo = expect_splice_negotiated_event!(node_b, node_a.node_id());
19691965

19701966
assert_ne!(original_txo, rbf_txo, "RBF should produce a different funding txo");
19711967

@@ -2170,8 +2166,7 @@ async fn splice_payment_reorged_to_unconfirmed() {
21702166

21712167
// node_b splices in, recording a funding payment it contributed to.
21722168
node_b.splice_in(&user_channel_id_b, node_a.node_id(), 1_000_000).unwrap();
2173-
let splice_txo = expect_splice_negotiated_event!(node_a, node_b.node_id());
2174-
expect_splice_negotiated_event!(node_b, node_a.node_id());
2169+
let splice_txo = expect_splice_negotiated_event!(node_b, node_a.node_id());
21752170
wait_for_tx(&electrsd.client, splice_txo.txid).await;
21762171
// Ensure node_b classified the splice before syncing so the test exercises a funding payment's
21772172
// reorg rather than a generic on-chain payment's.
@@ -2248,8 +2243,7 @@ async fn splice_in_rbf_joins_counterparty_splice() {
22482243
// node_b (which didn't fund the channel open, so holds the on-chain balance) initiates a
22492244
// splice-in; node_a does not contribute to this first candidate.
22502245
node_b.splice_in(&user_channel_id_b, node_a.node_id(), 1_000_000).unwrap();
2251-
let counterparty_txo = expect_splice_negotiated_event!(node_a, node_b.node_id());
2252-
expect_splice_negotiated_event!(node_b, node_a.node_id());
2246+
let counterparty_txo = expect_splice_negotiated_event!(node_b, node_a.node_id());
22532247
wait_for_tx(&electrsd.client, counterparty_txo.txid).await;
22542248
node_a.sync_wallets().unwrap();
22552249
node_b.sync_wallets().unwrap();

0 commit comments

Comments
 (0)