Skip to content

Commit c9cd694

Browse files
committed
Update LDK to 0.0.119, BDK to 0.29.0
1 parent 4ded800 commit c9cd694

File tree

14 files changed

+219
-136
lines changed

14 files changed

+219
-136
lines changed

Cargo.toml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ panic = 'abort' # Abort on panic
2828
default = []
2929

3030
[dependencies]
31-
lightning = { version = "0.0.118", features = ["std"] }
32-
lightning-invoice = { version = "0.26.0" }
33-
lightning-net-tokio = { version = "0.0.118" }
34-
lightning-persister = { version = "0.0.118" }
35-
lightning-background-processor = { version = "0.0.118", features = ["futures"] }
36-
lightning-rapid-gossip-sync = { version = "0.0.118" }
37-
lightning-transaction-sync = { version = "0.0.118", features = ["esplora-async-https"] }
38-
39-
# lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["std"] }
40-
# lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main" }
41-
# lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main" }
42-
# lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main" }
43-
# lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["futures"] }
44-
# lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main" }
45-
# lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["esplora-async"] }
31+
lightning = { version = "0.0.119", features = ["std"] }
32+
lightning-invoice = { version = "0.27.0" }
33+
lightning-net-tokio = { version = "0.0.119" }
34+
lightning-persister = { version = "0.0.119" }
35+
lightning-background-processor = { version = "0.0.119", features = ["futures"] }
36+
lightning-rapid-gossip-sync = { version = "0.0.119" }
37+
lightning-transaction-sync = { version = "0.0.119", features = ["esplora-async-https"] }
38+
39+
#lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["std"] }
40+
#lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main" }
41+
#lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main" }
42+
#lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main" }
43+
#lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["futures"] }
44+
#lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main" }
45+
#lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["esplora-async"] }
4646

4747
#lightning = { path = "../rust-lightning/lightning", features = ["std"] }
4848
#lightning-invoice = { path = "../rust-lightning/lightning-invoice" }
@@ -52,18 +52,18 @@ lightning-transaction-sync = { version = "0.0.118", features = ["esplora-async-h
5252
#lightning-rapid-gossip-sync = { path = "../rust-lightning/lightning-rapid-gossip-sync" }
5353
#lightning-transaction-sync = { path = "../rust-lightning/lightning-transaction-sync", features = ["esplora-async"] }
5454

55-
bdk = { version = "0.28.0", default-features = false, features = ["std", "async-interface", "use-esplora-async", "sqlite-bundled", "keys-bip39"]}
55+
bdk = { version = "0.29.0", default-features = false, features = ["std", "async-interface", "use-esplora-async", "sqlite-bundled", "keys-bip39"]}
5656

5757
reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls"] }
5858
rusqlite = { version = "0.28.0", features = ["bundled"] }
59-
bitcoin = "0.29.2"
59+
bitcoin = "0.30.2"
6060
bip39 = "2.0.0"
6161

6262
rand = "0.8.5"
6363
chrono = { version = "0.4", default-features = false, features = ["clock"] }
6464
futures = "0.3"
6565
tokio = { version = "1", default-features = false, features = [ "rt-multi-thread", "time", "sync" ] }
66-
esplora-client = { version = "0.4", default-features = false }
66+
esplora-client = { version = "0.6", default-features = false }
6767
libc = "0.2"
6868
uniffi = { version = "0.25.1", features = ["build"], optional = true }
6969

@@ -74,16 +74,16 @@ vss-client = "0.1"
7474
winapi = { version = "0.3", features = ["winbase"] }
7575

7676
[dev-dependencies]
77-
lightning = { version = "0.0.118", features = ["std", "_test_utils"] }
77+
lightning = { version = "0.0.119", features = ["std", "_test_utils"] }
7878
#lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["std", "_test_utils"] }
79-
electrsd = { version = "0.22.0", features = ["legacy", "esplora_a33e97e1", "bitcoind_23_0"] }
80-
electrum-client = "0.12.0"
79+
electrsd = { version = "0.26.0", features = ["legacy", "esplora_a33e97e1", "bitcoind_25_0"] }
80+
electrum-client = { version = "0.18.0", default-features = true }
8181
proptest = "1.0.0"
8282
regex = "1.5.6"
8383

8484
[target.'cfg(cln_test)'.dev-dependencies]
8585
clightningrpc = { version = "0.3.0-beta.8", default-features = false }
86-
bitcoincore-rpc = { version = "0.16.0", default-features = false }
86+
bitcoincore-rpc = { version = "0.17.0", default-features = false }
8787

8888
[build-dependencies]
8989
uniffi = { version = "0.25.1", features = ["build"], optional = true }

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ LDK Node is a self-custodial Lightning node in library form. Its central goal is
1111
The primary abstraction of the library is the [`Node`][api_docs_node], which can be retrieved by setting up and configuring a [`Builder`][api_docs_builder] to your liking and calling one of the `build` methods. `Node` can then be controlled via commands such as `start`, `stop`, `connect_open_channel`, `send_payment`, etc.
1212

1313
```rust
14-
use ldk_node::Builder;
14+
use ldk_node::{Builder, Network};
1515
use ldk_node::lightning_invoice::Invoice;
1616
use ldk_node::lightning::ln::msgs::SocketAddress;
1717
use ldk_node::bitcoin::secp256k1::PublicKey;
18-
use ldk_node::bitcoin::Network;
1918
use std::str::FromStr;
2019

2120
fn main() {

src/builder.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use crate::peer_store::PeerStore;
99
use crate::sweep::OutputSweeper;
1010
use crate::tx_broadcaster::TransactionBroadcaster;
1111
use crate::types::{
12-
ChainMonitor, ChannelManager, FakeMessageRouter, GossipSync, KeysManager, NetworkGraph,
13-
OnionMessenger, PeerManager,
12+
ChainMonitor, ChannelManager, FakeMessageRouter, GossipSync, KeysManager, Network,
13+
NetworkGraph, OnionMessenger, PeerManager,
1414
};
1515
use crate::wallet::Wallet;
1616
use crate::LogLevel;
@@ -47,8 +47,6 @@ use bdk::blockchain::esplora::EsploraBlockchain;
4747
use bdk::database::SqliteDatabase;
4848
use bdk::template::Bip84;
4949

50-
use bitcoin::Network;
51-
5250
use bip39::Mnemonic;
5351

5452
use bitcoin::BlockHash;
@@ -436,7 +434,7 @@ fn build_with_store_internal<K: KVStore + Sync + Send + 'static>(
436434
logger: Arc<FilesystemLogger>, kv_store: Arc<K>,
437435
) -> Result<Node<K>, BuildError> {
438436
// Initialize the on-chain wallet and chain access
439-
let xprv = bitcoin::util::bip32::ExtendedPrivKey::new_master(config.network, &seed_bytes)
437+
let xprv = bitcoin::bip32::ExtendedPrivKey::new_master(config.network.into(), &seed_bytes)
440438
.map_err(|e| {
441439
log_error!(logger, "Failed to derive master secret: {}", e);
442440
BuildError::InvalidSeedBytes
@@ -445,7 +443,7 @@ fn build_with_store_internal<K: KVStore + Sync + Send + 'static>(
445443
let wallet_name = bdk::wallet::wallet_name_from_descriptor(
446444
Bip84(xprv, bdk::KeychainKind::External),
447445
Some(Bip84(xprv, bdk::KeychainKind::Internal)),
448-
config.network,
446+
config.network.into(),
449447
&Secp256k1::new(),
450448
)
451449
.map_err(|e| {
@@ -459,7 +457,7 @@ fn build_with_store_internal<K: KVStore + Sync + Send + 'static>(
459457
let bdk_wallet = bdk::Wallet::new(
460458
Bip84(xprv, bdk::KeychainKind::External),
461459
Some(Bip84(xprv, bdk::KeychainKind::Internal)),
462-
config.network,
460+
config.network.into(),
463461
database,
464462
)
465463
.map_err(|e| {
@@ -537,7 +535,7 @@ fn build_with_store_internal<K: KVStore + Sync + Send + 'static>(
537535
Ok(graph) => Arc::new(graph),
538536
Err(e) => {
539537
if e.kind() == std::io::ErrorKind::NotFound {
540-
Arc::new(NetworkGraph::new(config.network, Arc::clone(&logger)))
538+
Arc::new(NetworkGraph::new(config.network.into(), Arc::clone(&logger)))
541539
} else {
542540
return Err(BuildError::ReadFailed);
543541
}
@@ -629,10 +627,10 @@ fn build_with_store_internal<K: KVStore + Sync + Send + 'static>(
629627
} else {
630628
// We're starting a fresh node.
631629
let genesis_block_hash =
632-
bitcoin::blockdata::constants::genesis_block(config.network).block_hash();
630+
bitcoin::blockdata::constants::genesis_block(config.network.into()).block_hash();
633631

634632
let chain_params = ChainParameters {
635-
network: config.network,
633+
network: config.network.into(),
636634
best_block: BestBlock::new(genesis_block_hash, 0),
637635
};
638636
channelmanager::ChannelManager::new(

src/event.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ use lightning::util::errors::APIError;
2323
use lightning::util::persist::KVStore;
2424
use lightning::util::ser::{Readable, ReadableArgs, Writeable, Writer};
2525

26+
use bitcoin::blockdata::locktime::absolute::LockTime;
2627
use bitcoin::secp256k1::PublicKey;
27-
use bitcoin::{LockTime, OutPoint};
28+
use bitcoin::OutPoint;
2829
use rand::{thread_rng, Rng};
2930
use std::collections::VecDeque;
3031
use std::ops::Deref;
@@ -786,6 +787,7 @@ where
786787
LdkEvent::HTLCIntercepted { .. } => {}
787788
LdkEvent::BumpTransaction(_) => {}
788789
LdkEvent::InvoiceRequestFailed { .. } => {}
790+
LdkEvent::ConnectionNeeded { .. } => {}
789791
}
790792
}
791793
}

src/fee_estimator.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ use lightning::chain::chaininterface::{
88
use bdk::FeeRate;
99
use esplora_client::AsyncClient as EsploraClient;
1010

11+
use bitcoin::blockdata::weight::Weight;
12+
1113
use std::collections::HashMap;
1214
use std::ops::Deref;
1315
use std::sync::RwLock;
@@ -33,7 +35,6 @@ where
3335
pub(crate) async fn update_fee_estimates(&self) -> Result<(), Error> {
3436
let confirmation_targets = vec![
3537
ConfirmationTarget::OnChainSweep,
36-
ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee,
3738
ConfirmationTarget::MinAllowedAnchorChannelRemoteFee,
3839
ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee,
3940
ConfirmationTarget::AnchorChannelFee,
@@ -43,7 +44,6 @@ where
4344
for target in confirmation_targets {
4445
let num_blocks = match target {
4546
ConfirmationTarget::OnChainSweep => 6,
46-
ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee => 1,
4747
ConfirmationTarget::MinAllowedAnchorChannelRemoteFee => 1008,
4848
ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee => 144,
4949
ConfirmationTarget::AnchorChannelFee => 1008,
@@ -77,12 +77,9 @@ where
7777
// LDK 0.0.118 introduced changes to the `ConfirmationTarget` semantics that
7878
// require some post-estimation adjustments to the fee rates, which we do here.
7979
let adjusted_fee_rate = match target {
80-
ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee => {
81-
let really_high_prio = fee_rate.as_sat_per_vb() * 10.0;
82-
FeeRate::from_sat_per_vb(really_high_prio)
83-
}
8480
ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee => {
85-
let slightly_less_than_background = fee_rate.fee_wu(1000) - 250;
81+
let slightly_less_than_background =
82+
fee_rate.fee_wu(Weight::from_wu(1000)) - 250;
8683
FeeRate::from_sat_per_kwu(slightly_less_than_background as f32)
8784
}
8885
_ => fee_rate,
@@ -94,7 +91,7 @@ where
9491
self.logger,
9592
"Fee rate estimation updated for {:?}: {} sats/kwu",
9693
target,
97-
adjusted_fee_rate.fee_wu(1000)
94+
adjusted_fee_rate.fee_wu(Weight::from_wu(1000))
9895
);
9996
}
10097
Ok(())
@@ -105,7 +102,6 @@ where
105102

106103
let fallback_sats_kwu = match confirmation_target {
107104
ConfirmationTarget::OnChainSweep => 5000,
108-
ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee => 25 * 250,
109105
ConfirmationTarget::MinAllowedAnchorChannelRemoteFee => FEERATE_FLOOR_SATS_PER_KW,
110106
ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee => FEERATE_FLOOR_SATS_PER_KW,
111107
ConfirmationTarget::AnchorChannelFee => 500,
@@ -125,7 +121,7 @@ where
125121
L::Target: Logger,
126122
{
127123
fn get_est_sat_per_1000_weight(&self, confirmation_target: ConfirmationTarget) -> u32 {
128-
(self.estimate_fee_rate(confirmation_target).fee_wu(1000) as u32)
124+
(self.estimate_fee_rate(confirmation_target).fee_wu(Weight::from_wu(1000)) as u32)
129125
.max(FEERATE_FLOOR_SATS_PER_KW)
130126
}
131127
}

0 commit comments

Comments
 (0)