]> git.bitcoin.ninja Git - ldk-sample/commitdiff
Update to 0.0.105 upstream API
authorMatt Corallo <git@bluematt.me>
Mon, 7 Mar 2022 18:41:07 +0000 (18:41 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 7 Mar 2022 19:51:41 +0000 (19:51 +0000)
Cargo.toml
src/cli.rs
src/main.rs

index 6a1546a3083f8fc2f64aab8f5ff3047c44ec407b..8e3fe5af8d8d1181f4cd54a99d8cf589d72d8d04 100644 (file)
@@ -8,12 +8,12 @@ edition = "2018"
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 
 [dependencies]
-lightning = { version = "0.0.104", features = ["max_level_trace"] }
-lightning-block-sync = { version = "0.0.104", features = [ "rpc-client" ] }
-lightning-invoice = { version = "0.12.0" }
-lightning-net-tokio = { version = "0.0.104" }
-lightning-persister = { version = "0.0.104" }
-lightning-background-processor = { version = "0.0.104" }
+lightning = { version = "0.0.105", features = ["max_level_trace"] }
+lightning-block-sync = { version = "0.0.105", features = [ "rpc-client" ] }
+lightning-invoice = { version = "0.13" }
+lightning-net-tokio = { version = "0.0.105" }
+lightning-persister = { version = "0.0.105" }
+lightning-background-processor = { version = "0.0.105" }
 
 base64 = "0.13.0"
 bitcoin = "0.27"
@@ -25,7 +25,7 @@ futures = "0.3"
 chrono = "0.4"
 rand = "0.4"
 serde_json = { version = "1.0" }
-tokio = { version = "1.5", features = [ "io-util", "macros", "rt", "rt-multi-thread", "sync", "net", "time" ] }
+tokio = { version = "1", features = [ "io-util", "macros", "rt", "rt-multi-thread", "sync", "net", "time" ] }
 
 [profile.release]
 panic = "abort"
index a167027f5a85d3de4a70040a6a30db575900d64e..c7dffd280b3bbc3a74119bd09f1dd9ec669ed809 100644 (file)
@@ -8,7 +8,7 @@ use bitcoin::hashes::sha256::Hash as Sha256;
 use bitcoin::hashes::Hash;
 use bitcoin::network::constants::Network;
 use bitcoin::secp256k1::key::PublicKey;
-use lightning::chain::keysinterface::{KeysInterface, KeysManager};
+use lightning::chain::keysinterface::{KeysInterface, KeysManager, Recipient};
 use lightning::ln::msgs::NetAddress;
 use lightning::ln::{PaymentHash, PaymentPreimage};
 use lightning::util::config::{ChannelConfig, ChannelHandshakeLimits, UserConfig};
@@ -355,7 +355,7 @@ pub(crate) async fn poll_for_user_input<E: EventHandler>(
                                                "{:?}",
                                                lightning::util::message_signing::sign(
                                                        &line.as_bytes()[MSG_STARTPOS..],
-                                                       &keys_manager.get_node_secret()
+                                                       &keys_manager.get_node_secret(Recipient::Node).unwrap()
                                                )
                                        );
                                }
index 0e18bc03c52af47596608488bbad4cfe807263a4..a974b7684c14a67348cfe946fb54b644f650d565 100644 (file)
@@ -16,7 +16,7 @@ use bitcoin_bech32::WitnessProgram;
 use lightning::chain;
 use lightning::chain::chaininterface::{BroadcasterInterface, ConfirmationTarget, FeeEstimator};
 use lightning::chain::chainmonitor;
-use lightning::chain::keysinterface::{InMemorySigner, KeysInterface, KeysManager};
+use lightning::chain::keysinterface::{InMemorySigner, KeysInterface, KeysManager, Recipient};
 use lightning::chain::{BestBlock, Filter, Watch};
 use lightning::ln::channelmanager;
 use lightning::ln::channelmanager::{
@@ -218,6 +218,9 @@ async fn handle_ldk_events(
                                }
                        }
                }
+               Event::OpenChannelRequest { .. } => {
+                       // Unreachable, we don't set manually_accept_inbound_channels
+               }
                Event::PaymentPathSuccessful { .. } => {}
                Event::PaymentPathFailed { .. } => {}
                Event::PaymentFailed { payment_hash, .. } => {
@@ -397,7 +400,7 @@ async fn start_ldk() {
        let mut user_config = UserConfig::default();
        user_config.peer_channel_config_limits.force_announced_channel_preference = false;
        let mut restarting_node = true;
-       let (channel_manager_blockhash, mut channel_manager) = {
+       let (channel_manager_blockhash, channel_manager) = {
                if let Ok(mut f) = fs::File::open(format!("{}/manager", ldk_data_dir.clone())) {
                        let mut channel_monitor_mut_references = Vec::new();
                        for (_, channel_monitor) in channelmonitors.iter_mut() {
@@ -444,7 +447,7 @@ async fn start_ldk() {
        let mut chain_tip: Option<poll::ValidatedBlockHeader> = None;
        if restarting_node {
                let mut chain_listeners =
-                       vec![(channel_manager_blockhash, &mut channel_manager as &mut dyn chain::Listen)];
+                       vec![(channel_manager_blockhash, &channel_manager as &dyn chain::Listen)];
 
                for (blockhash, channel_monitor) in channelmonitors.drain(..) {
                        let outpoint = channel_monitor.get_funding_txo().0;
@@ -456,10 +459,8 @@ async fn start_ldk() {
                }
 
                for monitor_listener_info in chain_listener_channel_monitors.iter_mut() {
-                       chain_listeners.push((
-                               monitor_listener_info.0,
-                               &mut monitor_listener_info.1 as &mut dyn chain::Listen,
-                       ));
+                       chain_listeners
+                               .push((monitor_listener_info.0, &monitor_listener_info.1 as &dyn chain::Listen));
                }
                chain_tip = Some(
                        init::synchronize_listeners(
@@ -516,7 +517,7 @@ async fn start_ldk() {
        };
        let peer_manager: Arc<PeerManager> = Arc::new(PeerManager::new(
                lightning_msg_handler,
-               keys_manager.get_node_secret(),
+               keys_manager.get_node_secret(Recipient::Node).unwrap(),
                &ephemeral_bytes,
                logger.clone(),
                Arc::new(IgnoringMessageHandler {}),