Skip to content

Commit 299638d

Browse files
authored
Expose local ENR Arc (#214)
1 parent d2e30e0 commit 299638d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/discv5.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,13 @@ impl<P: ProtocolIdentity> Discv5<P> {
301301
self.local_enr.read().clone()
302302
}
303303

304+
/// Identical to `Discv5::local_enr` except that this exposes the `Arc` itself.
305+
///
306+
/// This is useful for synchronising views of the local ENR outside of `Discv5`.
307+
pub fn external_enr(&self) -> Arc<RwLock<Enr>> {
308+
self.local_enr.clone()
309+
}
310+
304311
/// Returns the routing table of the discv5 service
305312
pub fn kbuckets(&self) -> KBucketsTable<NodeId, Enr> {
306313
self.kbuckets.read().clone()

0 commit comments

Comments
 (0)