Skip to content

Commit

Permalink
IdentifyMessage::decode allow failure on Unsupported MultiAddr
Browse files Browse the repository at this point in the history
  • Loading branch information
eval-exec committed Dec 25, 2024
1 parent 62af260 commit eec0388
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion network/src/protocols/identify/protocol.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use ckb_logger::warn;
use p2p::{bytes::Bytes, multiaddr::Multiaddr};

use ckb_types::{packed, prelude::*};
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit eec0388

Please sign in to comment.