lightningdevkit / ldk-sample

Sample node implementation using LDK
Apache License 2.0
166 stars 94 forks source link

Upgrade to LDK 0.0.118 #123

Closed TheBlueMatt closed 11 months ago

TheBlueMatt commented 11 months ago

Guess I kinda forgot about this one. Anyway, finally cleaned it up.

TheBlueMatt commented 11 months ago
$ git diff-tree -U1 002aaa5 37da86a
diff --git a/Cargo.toml b/Cargo.toml
index b323979..dac94fb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,9 +10,9 @@ edition = "2018"
 [dependencies]
-lightning = { version = "0.0.117", features = ["max_level_trace"] }
-lightning-block-sync = { version = "0.0.117", features = [ "rpc-client", "tokio" ] }
-lightning-invoice = { version = "0.25.0" }
-lightning-net-tokio = { version = "0.0.117" }
-lightning-persister = { version = "0.0.117" }
-lightning-background-processor = { version = "0.0.117", features = [ "futures" ] }
-lightning-rapid-gossip-sync = { version = "0.0.117" }
+lightning = { version = "0.0.118", features = ["max_level_trace"] }
+lightning-block-sync = { version = "0.0.118", features = [ "rpc-client", "tokio" ] }
+lightning-invoice = { version = "0.26.0" }
+lightning-net-tokio = { version = "0.0.118" }
+lightning-persister = { version = "0.0.118" }
+lightning-background-processor = { version = "0.0.118", features = [ "futures" ] }
+lightning-rapid-gossip-sync = { version = "0.0.118" }

diff --git a/src/bitcoind_client.rs b/src/bitcoind_client.rs
index 564b7e2..17ea74c 100644
--- a/src/bitcoind_client.rs
+++ b/src/bitcoind_client.rs
@@ -17,3 +17,2 @@ use lightning::events::bump_transaction::{Utxo, WalletSource};
 use lightning::log_error;
-use lightning::routing::utxo::{UtxoLookup, UtxoResult};
 use lightning::util::logger::Logger;
@@ -79,7 +78,16 @@ impl BitcoindClient {
        fees.insert(ConfirmationTarget::OnChainSweep, AtomicU32::new(5000));
-       fees.insert(ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee, AtomicU32::new(25 * 250));
-       fees.insert(ConfirmationTarget::MinAllowedAnchorChannelRemoteFee, AtomicU32::new(MIN_FEERATE));
-       fees.insert(ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee, AtomicU32::new(MIN_FEERATE));
+       fees.insert(
+           ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee,
+           AtomicU32::new(25 * 250),
+       );
+       fees.insert(
+           ConfirmationTarget::MinAllowedAnchorChannelRemoteFee,
+           AtomicU32::new(MIN_FEERATE),
+       );
+       fees.insert(
+           ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee,
+           AtomicU32::new(MIN_FEERATE),
+       );
        fees.insert(ConfirmationTarget::AnchorChannelFee, AtomicU32::new(MIN_FEERATE));
-       fees.insert(ConfirmationTarget::NonAnchorChannelFee, AtomicU32::new(MIN_FEERATE));
+       fees.insert(ConfirmationTarget::NonAnchorChannelFee, AtomicU32::new(2000));
        fees.insert(ConfirmationTarget::ChannelCloseMinimum, AtomicU32::new(MIN_FEERATE));
@@ -174,3 +182,3 @@ impl BitcoindClient {
                    .unwrap()
-                   .store(std::cmp::max(25*250, high_prio_estimate), Ordering::Release);
+                   .store(std::cmp::max(25 * 250, high_prio_estimate * 10), Ordering::Release);
                fees.get(&ConfirmationTarget::MinAllowedAnchorChannelRemoteFee)
diff --git a/src/main.rs b/src/main.rs
index 563e94d..6480805 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -168,3 +168,4 @@ pub(crate) type NetworkGraph = gossip::NetworkGraph<Arc<FilesystemLogger>>;

-type OnionMessenger = SimpleArcOnionMessenger<ChainMonitor, BitcoindClient, BitcoindClient, FilesystemLogger>;
+type OnionMessenger =
+   SimpleArcOnionMessenger<ChainMonitor, BitcoindClient, BitcoindClient, FilesystemLogger>;

@@ -372,6 +373,3 @@ async fn handle_ldk_events(
        Event::InvoiceRequestFailed { payment_id } => {
-           print!(
-               "\nEVENT: Failed to request invoice to send payment with id {}",
-               payment_id,
-           );
+           print!("\nEVENT: Failed to request invoice to send payment with id {}", payment_id);
            print!("> ");