# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-lightning = { version = "0.0.108", features = ["max_level_trace"] }
-lightning-block-sync = { version = "0.0.108", features = [ "rpc-client" ] }
-lightning-invoice = { version = "0.16" }
-lightning-net-tokio = { version = "0.0.108" }
-lightning-persister = { version = "0.0.108" }
-lightning-background-processor = { version = "0.0.108" }
-lightning-rapid-gossip-sync = { version = "0.0.108" }
+lightning = { version = "0.0.109", features = ["max_level_trace"] }
+lightning-block-sync = { version = "0.0.109", features = [ "rpc-client" ] }
+lightning-invoice = { version = "0.17" }
+lightning-net-tokio = { version = "0.0.109" }
+lightning-persister = { version = "0.0.109" }
+lightning-background-processor = { version = "0.0.109" }
+lightning-rapid-gossip-sync = { version = "0.0.109" }
base64 = "0.13.0"
bitcoin = "0.28.1"
use crate::disk;
use crate::hex_utils;
use crate::{
- ChannelManager, HTLCStatus, InvoicePayer, MillisatAmount, NetworkGraph, NodeAlias, PaymentInfo,
+ ChannelManager, HTLCStatus, InvoicePayer, MillisatAmount, NetworkGraph, PaymentInfo,
PaymentInfoStorage, PeerManager,
};
use bitcoin::hashes::sha256::Hash as Sha256;
use lightning::ln::msgs::NetAddress;
use lightning::ln::{PaymentHash, PaymentPreimage};
use lightning::routing::gossip::NodeId;
-use lightning::util::config::{ChannelConfig, ChannelHandshakeLimits, UserConfig};
+use lightning::util::config::{ChannelHandshakeConfig, ChannelHandshakeLimits, UserConfig};
use lightning::util::events::EventHandler;
use lightning_invoice::payment::PaymentError;
use lightning_invoice::{utils, Currency, Invoice};
.get(&NodeId::from_pubkey(&chan_info.counterparty.node_id))
{
if let Some(announcement) = &node_info.announcement_info {
- println!("\t\tpeer_alias: {}", NodeAlias(&announcement.alias));
+ println!("\t\tpeer_alias: {}", announcement.alias);
}
}
channel_manager: Arc<ChannelManager>,
) -> Result<(), ()> {
let config = UserConfig {
- peer_channel_config_limits: ChannelHandshakeLimits {
+ channel_handshake_limits: ChannelHandshakeLimits {
// lnd's max to_self_delay is 2016, so we want to be compatible.
their_to_self_delay: 2016,
..Default::default()
},
- channel_options: ChannelConfig { announced_channel, ..Default::default() },
+ channel_handshake_config: ChannelHandshakeConfig {
+ announced_channel,
+ ..Default::default()
+ },
..Default::default()
};
fn force_close_channel(
channel_id: [u8; 32], counterparty_node_id: PublicKey, channel_manager: Arc<ChannelManager>,
) {
- match channel_manager.force_close_channel(&channel_id, &counterparty_node_id) {
+ match channel_manager.force_close_broadcasting_latest_txn(&channel_id, &counterparty_node_id) {
Ok(()) => println!("EVENT: initiating channel force-close"),
Err(e) => println!("ERROR: failed to force-close channel: {:?}", e),
}
) -> ProbabilisticScorer<Arc<NetworkGraph>, Arc<FilesystemLogger>> {
let params = ProbabilisticScoringParameters::default();
if let Ok(file) = File::open(path) {
- let args = (params, Arc::clone(&graph), Arc::clone(&logger));
+ let args = (params.clone(), Arc::clone(&graph), Arc::clone(&logger));
if let Ok(scorer) = ProbabilisticScorer::read(&mut BufReader::new(file), args) {
return scorer;
}
pub(crate) type NetworkGraph = gossip::NetworkGraph<Arc<FilesystemLogger>>;
-struct NodeAlias<'a>(&'a [u8; 32]);
-
-impl fmt::Display for NodeAlias<'_> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- let alias = self
- .0
- .iter()
- .map(|b| *b as char)
- .take_while(|c| *c != '\0')
- .filter(|c| c.is_ascii_graphic() || *c == ' ')
- .collect::<String>();
- write!(f, "{}", alias)
- }
-}
-
async fn handle_ldk_events(
channel_manager: &Arc<ChannelManager>, bitcoind_client: &BitcoindClient,
network_graph: &NetworkGraph, keys_manager: &KeysManager,
Some(node) => match &node.announcement_info {
None => " from unnamed node".to_string(),
Some(announcement) => {
- format!(" from node {}", NodeAlias(&announcement.alias))
+ format!(" from node {}", announcement.alias)
}
},
}
// Step 8: Initialize the ChannelManager
let mut user_config = UserConfig::default();
- user_config.peer_channel_config_limits.force_announced_channel_preference = false;
+ user_config.channel_handshake_limits.force_announced_channel_preference = false;
let mut restarting_node = true;
let (channel_manager_blockhash, channel_manager) = {
if let Ok(mut f) = fs::File::open(format!("{}/manager", ldk_data_dir.clone())) {