File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ use crate::sync::{RwLock, RwLockReadGuard};
43
43
use core:: sync:: atomic:: { AtomicUsize , Ordering } ;
44
44
use crate :: sync:: Mutex ;
45
45
use core:: ops:: { Bound , Deref } ;
46
+ use core:: str:: FromStr ;
46
47
47
48
#[ cfg( feature = "std" ) ]
48
49
use std:: time:: { SystemTime , UNIX_EPOCH } ;
@@ -142,6 +143,14 @@ impl From<NodeId> for PublicKey {
142
143
}
143
144
}
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
+
145
154
/// Represents the network as nodes and channels between them
146
155
pub struct NetworkGraph < L : Deref > where L :: Target : Logger {
147
156
secp_ctx : Secp256k1 < secp256k1:: VerifyOnly > ,
You can’t perform that action at this time.
0 commit comments