Skip to content

Commit

Permalink
Tolerate cid codecs we don't understand in bitswap queries
Browse files Browse the repository at this point in the history
  • Loading branch information
ianopolous committed Sep 30, 2024
1 parent eb35b5a commit c359692
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,12 @@ public void receiveMessage(MessageOuterClass.Message msg, Stream source, Counter
int presentBlocks = 0;
if (msg.hasWantlist()) {
for (MessageOuterClass.Message.Wantlist.Entry e : msg.getWantlist().getEntriesList()) {
Cid c = Cid.cast(e.getBlock().toByteArray());
Cid c;
try {
c = Cid.cast(e.getBlock().toByteArray());
} catch (Exception ex) {
continue;
}
Optional<String> auth = e.getAuth().isEmpty() ? Optional.empty() : Optional.of(ArrayOps.bytesToHex(e.getAuth().toByteArray()));
boolean isCancel = e.getCancel();
boolean sendDontHave = e.getSendDontHave();
Expand Down

0 comments on commit c359692

Please sign in to comment.