mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
perf: replace BytesMut with alloy_rlp::encode (#7432)
This commit is contained in:
committed by
GitHub
parent
f71d9c0003
commit
933317c62a
@ -352,10 +352,7 @@ pub struct UnauthedP2PStream<S> {
|
||||
impl<S> UnauthedP2PStream<S> {
|
||||
// ...
|
||||
pub async fn handshake(mut self, hello: HelloMessage) -> Result<(P2PStream<S>, HelloMessage), Error> {
|
||||
let mut raw_hello_bytes = BytesMut::new();
|
||||
P2PMessage::Hello(hello.clone()).encode(&mut raw_hello_bytes);
|
||||
|
||||
self.inner.send(raw_hello_bytes.into()).await?;
|
||||
self.inner.send(alloy_rlp::encode(P2PMessage::Hello(hello.clone())).into()).await?;
|
||||
let first_message_bytes = tokio::time::timeout(HANDSHAKE_TIMEOUT, self.inner.next()).await;
|
||||
|
||||
let their_hello = match P2PMessage::decode(&mut &first_message_bytes[..]) {
|
||||
|
||||
Reference in New Issue
Block a user