From eec0388aefc8b66bee29f91e0360b08a759f7a8e Mon Sep 17 00:00:00 2001 From: Eval EXEC Date: Wed, 25 Dec 2024 12:26:19 +0800 Subject: [PATCH] `IdentifyMessage::decode` allow failure on Unsupported MultiAddr --- network/src/protocols/identify/protocol.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/network/src/protocols/identify/protocol.rs b/network/src/protocols/identify/protocol.rs index 1c15fc5f58..e68a083e53 100644 --- a/network/src/protocols/identify/protocol.rs +++ b/network/src/protocols/identify/protocol.rs @@ -1,3 +1,4 @@ +use ckb_logger::warn; use p2p::{bytes::Bytes, multiaddr::Multiaddr}; use ckb_types::{packed, prelude::*}; @@ -69,7 +70,12 @@ impl<'a> IdentifyMessage<'a> { Multiaddr::try_from(reader.observed_addr().bytes().raw_data().to_vec()).ok()?; let mut listen_addrs = Vec::with_capacity(reader.listen_addrs().len()); for addr in reader.listen_addrs().iter() { - listen_addrs.push(Multiaddr::try_from(addr.bytes().raw_data().to_vec()).ok()?) + match Multiaddr::try_from(addr.bytes().raw_data().to_vec()) { + Ok(multi_addr) => { + listen_addrs.push(multi_addr); + } + Err(err) => warn!("failed to decode listen_addr to MultiAddr: {}", err), + } } Some(IdentifyMessage {