matrix:
toolchain:
- stable
- - 1.56.0
+ - 1.63.0
- beta
runs-on: ubuntu-latest
steps:
edition = "2021"
[dependencies]
-bitcoin = "0.29"
-lightning = { version = "0.0.118" }
-lightning-block-sync = { version = "0.0.118", features=["rest-client"] }
-lightning-net-tokio = { version = "0.0.118" }
+bitcoin = "0.30"
+hex-conservative = "0.2"
+lightning = { version = "0.0.121" }
+lightning-block-sync = { version = "0.0.121", features=["rest-client"] }
+lightning-net-tokio = { version = "0.0.121" }
tokio = { version = "1.25", features = ["full"] }
tokio-postgres = { version = "=0.7.5" }
futures = "0.3"
[dev-dependencies]
-lightning = { version = "0.0.118", features = ["_test_utils"] }
-lightning-rapid-gossip-sync = { version = "0.0.118" }
+lightning = { version = "0.0.121", features = ["_test_utils"] }
+lightning-rapid-gossip-sync = { version = "0.0.121" }
[profile.dev]
panic = "abort"
#[cfg(test)]
mod tests {
use super::*;
- use bitcoin::hashes::hex::ToHex;
+ use hex_conservative::DisplayHex;
use std::str::FromStr;
#[test]
fn test_resolve_peer_info() {
let wallet_of_satoshi = "035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735";
let (pubkey, socket_address) = resolve_peer_info(wallet_of_satoshi).unwrap();
- assert_eq!(pubkey.serialize().to_hex(), "035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226");
+ assert_eq!(
+ pubkey.serialize().to_lower_hex_string(),
+ "035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226"
+ );
assert_eq!(socket_address.to_string(), "170.75.163.209:9735");
let ipv6 = "033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025@[2001:db8::1]:80";
let (pubkey, socket_address) = resolve_peer_info(ipv6).unwrap();
- assert_eq!(pubkey.serialize().to_hex(), "033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025");
+ assert_eq!(
+ pubkey.serialize().to_lower_hex_string(),
+ "033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025"
+ );
assert_eq!(socket_address.to_string(), "[2001:db8::1]:80");
let localhost = "033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025@localhost:9735";
let (pubkey, socket_address) = resolve_peer_info(localhost).unwrap();
- assert_eq!(pubkey.serialize().to_hex(), "033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025");
+ assert_eq!(
+ pubkey.serialize().to_lower_hex_string(),
+ "033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025"
+ );
let socket_address = socket_address.to_string();
assert!(socket_address == "127.0.0.1:9735" || socket_address == "[::1]:9735");
}
use bitcoin::secp256k1::ecdsa::Signature;
use bitcoin::secp256k1::{Secp256k1, SecretKey};
use bitcoin::hashes::Hash;
-use bitcoin::hashes::hex::ToHex;
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
+use hex_conservative::DisplayHex;
use lightning::ln::features::ChannelFeatures;
use lightning::ln::msgs::{ChannelAnnouncement, ChannelUpdate, UnsignedChannelAnnouncement, UnsignedChannelUpdate};
use lightning::routing::gossip::{NetworkGraph, NodeId};
let thread_id = thread::current().id();
let preimage = format!("{:?}-{}", thread_id, timestamp_nanos);
println!("test schema preimage: {}", preimage);
- let suffix = Sha256dHash::hash(preimage.as_bytes()).into_inner().to_hex();
+ let suffix = Sha256dHash::hash(preimage.as_bytes()).encode();
// the schema must start with a letter
- let schema = format!("test_{}_{}", timestamp_seconds, suffix);
+ let schema = format!("test_{}_{}", timestamp_seconds, suffix.as_hex());
*suffix_option = Some(schema);
});
use std::sync::Arc;
use std::time::{Duration, Instant};
-use bitcoin::hashes::hex::ToHex;
use bitcoin::secp256k1::PublicKey;
+use hex_conservative::display::DisplayHex;
use lightning::ln::peer_handler::{
ErroringMessageHandler, IgnoringMessageHandler, MessageHandler, PeerManager,
};
// we seek to find out if the first connection attempt was successful
let (sender, mut receiver) = mpsc::channel::<bool>(1);
tokio::spawn(async move {
- log_info!(logger, "Connecting to peer {}@{}...", current_peer.0.to_hex(), current_peer.1.to_string());
+ let current_peer_pubkey_hex = current_peer.0.serialize().to_lower_hex_string();
+ log_info!(logger, "Connecting to peer {}@{}...", current_peer_pubkey_hex, current_peer.1);
let mut is_first_iteration = true;
loop {
if let Some(disconnection_future) = lightning_net_tokio::connect_outbound(
current_peer.0,
current_peer.1,
).await {
- log_info!(logger, "Connected to peer {}@{}!", current_peer.0.to_hex(), current_peer.1.to_string());
+ log_info!(logger, "Connected to peer {}@{}!", current_peer_pubkey_hex, current_peer.1);
if is_first_iteration {
sender.send(true).await.unwrap();
}
disconnection_future.await;
- log_warn!(logger, "Disconnected from peer {}@{}", current_peer.0.to_hex(), current_peer.1.to_string());
+ log_warn!(logger, "Disconnected from peer {}@{}", current_peer_pubkey_hex, current_peer.1);
} else {
- log_warn!(logger, "Failed to connect to peer {}@{}!", current_peer.0.to_hex(), current_peer.1.to_string());
+ log_warn!(logger, "Failed to connect to peer {}@{}!", current_peer_pubkey_hex, current_peer.1);
if is_first_iteration {
sender.send(false).await.unwrap();
}
}
is_first_iteration = false;
tokio::time::sleep(Duration::from_secs(10)).await;
- log_warn!(logger, "Reconnecting to peer {}@{}...", current_peer.0.to_hex(), current_peer.1.to_string());
+ log_warn!(logger, "Reconnecting to peer {}@{}...", current_peer_pubkey_hex, current_peer.1);
}
});
}
impl Logger for RGSSLogger {
- fn log(&self, record: &Record) {
+ fn log(&self, record: Record) {
let threshold = config::log_level();
if record.level < threshold {
return;
}
impl Logger for TestLogger {
- fn log(&self, record: &Record) {
+ fn log(&self, record: Record) {
*self.lines.lock().unwrap().entry((record.module_path.to_string(), format!("{}", record.args))).or_insert(0) += 1;
println!("{:<5} {} [{} : {}, {}] {}", record.level.to_string(), self.id, record.module_path, record.file, record.line, record.args);
}