Skip to content

Commit

Permalink
fix: remove duplicate peer id in ipfs addr
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielc committed May 13, 2024
1 parent e44cfee commit f567ea8
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions operator/src/network/ipfs_rpc.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::{anyhow, bail, Result};
use async_trait::async_trait;
use keramik_common::peer_info::IpfsPeerInfo;
use multiaddr::{multihash::Multihash, Multiaddr, Protocol};
use multiaddr::Multiaddr;
use serde::Deserialize;

/// Define the behavior we consume from the IPFS RPC API.
Expand Down Expand Up @@ -48,9 +48,6 @@ impl IpfsRpcClient for HttpRpcClient {
}
let data: Response = resp.json().await?;

let p2p_proto = Protocol::P2p(Multihash::from_bytes(
&multibase::Base::Base58Btc.decode(data.id.clone())?,
)?);
// We expect to find at least one non loop back address
let p2p_addrs = data
.addresses
Expand All @@ -63,11 +60,7 @@ impl IpfsRpcClient for HttpRpcClient {
_ => false,
})
})
// Add peer id to multiaddrs
.map(|mut addr| {
addr.push(p2p_proto.clone());
addr.to_string()
})
.map(|addr| addr.to_string())
.collect::<Vec<String>>();

if !p2p_addrs.is_empty() {
Expand Down

0 comments on commit f567ea8

Please sign in to comment.