Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions polkadot-bulletin-chain
Submodule polkadot-bulletin-chain added at e9e2f8
9 changes: 5 additions & 4 deletions substrate/client/network/src/bitswap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const MAX_WANTED_BLOCKS: usize = 16;
/// Bitswap protocol name
const PROTOCOL_NAME: &'static str = "/ipfs/bitswap/1.2.0";


/// Prefix represents all metadata of a CID, without the actual content.
#[derive(PartialEq, Eq, Clone, Debug)]
struct Prefix {
Expand Down Expand Up @@ -121,7 +122,7 @@ impl<B: BlockT> BitswapRequestHandler<B> {
while let Some(request) = self.request_receiver.next().await {
let IncomingRequest { peer, payload, pending_response } = request;

match self.handle_message(&peer, &payload) {
match self.handle_message(&peer, payload.as_slice()) {
Ok(response) => {
let response = OutgoingResponse {
result: Ok(response),
Expand All @@ -135,7 +136,7 @@ impl<B: BlockT> BitswapRequestHandler<B> {
},
Err(_) => debug!(
target: LOG_TARGET,
"Failed to handle light client request from {peer}: {}",
"Failed to handle bitswap request from {peer}: {}",
BitswapError::SendResponse,
),
}
Expand Down Expand Up @@ -167,9 +168,9 @@ impl<B: BlockT> BitswapRequestHandler<B> {
fn handle_message(
&mut self,
peer: &PeerId,
payload: &Vec<u8>,
payload: &[u8],
) -> Result<Vec<u8>, BitswapError> {
let request = schema::bitswap::Message::decode(&payload[..])?;
let request = schema::bitswap::Message::decode(payload)?;

trace!(target: LOG_TARGET, "Received request: {:?} from {}", request, peer);

Expand Down
Loading