mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: prevent panic during enr conversion (#10824)
This commit is contained in:
@ -148,9 +148,11 @@ impl Discv5 {
|
||||
/// Returns the [`NodeRecord`] of the local node.
|
||||
///
|
||||
/// This includes the currently tracked external IP address of the node.
|
||||
pub fn node_record(&self) -> NodeRecord {
|
||||
///
|
||||
/// Returns `None` if the local ENR does not contain the required fields.
|
||||
pub fn node_record(&self) -> Option<NodeRecord> {
|
||||
let enr: Enr<_> = EnrCombinedKeyWrapper(self.discv5.local_enr()).into();
|
||||
(&enr).try_into().unwrap()
|
||||
enr.try_into().ok()
|
||||
}
|
||||
|
||||
/// Spawns [`discv5::Discv5`]. Returns [`discv5::Discv5`] handle in reth compatible wrapper type
|
||||
|
||||
Reference in New Issue
Block a user