use bitcoin::hashes::sha256d::Hash as Sha256dHash;
use bitcoin::hashes::Hash;
+use bitcoin::hashes::hex::FromHex;
use bitcoin::hash_types::BlockHash;
use bitcoin::network::constants::Network;
use core::sync::atomic::{AtomicUsize, Ordering};
use crate::sync::Mutex;
use core::ops::{Bound, Deref};
+use core::str::FromStr;
#[cfg(feature = "std")]
use std::time::{SystemTime, UNIX_EPOCH};
}
}
+impl FromStr for NodeId {
+ type Err = bitcoin::hashes::hex::Error;
+
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ let data: [u8; PUBLIC_KEY_SIZE] = FromHex::from_hex(s)?;
+ Ok(NodeId(data))
+ }
+}
+
/// Represents the network as nodes and channels between them
pub struct NetworkGraph<L: Deref> where L::Target: Logger {
secp_ctx: Secp256k1<secp256k1::VerifyOnly>,