mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: bump discv5 (#7981)
This commit is contained in:
@ -23,8 +23,6 @@ alloy-primitives.workspace = true
|
||||
alloy-rlp.workspace = true
|
||||
discv5 = { workspace = true, features = ["libp2p"] }
|
||||
enr.workspace = true
|
||||
multiaddr = { version = "0.18", default-features = false }
|
||||
libp2p-identity = "0.2"
|
||||
secp256k1.workspace = true
|
||||
|
||||
# async/futures
|
||||
|
||||
@ -8,8 +8,10 @@ use std::{
|
||||
|
||||
use alloy_primitives::Bytes;
|
||||
use derive_more::Display;
|
||||
use discv5::ListenConfig;
|
||||
use multiaddr::{Multiaddr, Protocol};
|
||||
use discv5::{
|
||||
multiaddr::{Multiaddr, Protocol},
|
||||
ListenConfig,
|
||||
};
|
||||
use reth_ethereum_forks::{EnrForkIdEntry, ForkId};
|
||||
use reth_network_peers::NodeRecord;
|
||||
use tracing::warn;
|
||||
|
||||
@ -24,13 +24,13 @@ pub fn discv4_id_to_discv5_id(peer_id: PeerId) -> Result<NodeId, secp256k1::Erro
|
||||
Ok(id2pk(peer_id)?.into())
|
||||
}
|
||||
|
||||
/// Converts a [`PeerId`] to a [`libp2p_identity::PeerId `].
|
||||
/// Converts a [`PeerId`] to a [`reth_network_peers::PeerId`].
|
||||
pub fn discv4_id_to_multiaddr_id(
|
||||
peer_id: PeerId,
|
||||
) -> Result<libp2p_identity::PeerId, secp256k1::Error> {
|
||||
) -> Result<discv5::libp2p_identity::PeerId, secp256k1::Error> {
|
||||
let pk = id2pk(peer_id)?.encode();
|
||||
let pk: libp2p_identity::PublicKey =
|
||||
libp2p_identity::secp256k1::PublicKey::try_from_bytes(&pk).unwrap().into();
|
||||
let pk: discv5::libp2p_identity::PublicKey =
|
||||
discv5::libp2p_identity::secp256k1::PublicKey::try_from_bytes(&pk).unwrap().into();
|
||||
|
||||
Ok(pk.to_peer_id())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user