We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e1b50cf commit 9330b07Copy full SHA for 9330b07
lightning/src/routing/gossip.rs
@@ -43,6 +43,7 @@ use crate::sync::{RwLock, RwLockReadGuard};
43
use core::sync::atomic::{AtomicUsize, Ordering};
44
use crate::sync::Mutex;
45
use core::ops::{Bound, Deref};
46
+use core::str::FromStr;
47
48
#[cfg(feature = "std")]
49
use std::time::{SystemTime, UNIX_EPOCH};
@@ -142,6 +143,14 @@ impl From<NodeId> for PublicKey {
142
143
}
144
145
146
+impl FromStr for NodeId {
147
+ type Err = secp256k1::Error;
148
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
149
+ let pubkey = PublicKey::from_str(s)?;
150
+ Ok(NodeId::from_pubkey(&pubkey))
151
+ }
152
+}
153
+
154
/// Represents the network as nodes and channels between them
155
pub struct NetworkGraph<L: Deref> where L::Target: Logger {
156
secp_ctx: Secp256k1<secp256k1::VerifyOnly>,
0 commit comments