Skip to content

Commit

Permalink
fix: use multicodec correctly (#209)
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
  • Loading branch information
hacdias authored and dirkmc committed Dec 22, 2019
1 parent 958c467 commit 579ddb5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"ipfs-block": "~0.8.0",
"just-debounce-it": "^1.1.0",
"moving-average": "^1.0.0",
"multicodec": "~0.5.0",
"multicodec": "~0.5.7",
"multihashing-async": "^0.8.0",
"protons": "^1.0.1",
"pull-length-prefixed": "^1.3.1",
Expand Down
4 changes: 2 additions & 2 deletions src/types/message/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const protons = require('protons')
const Block = require('ipfs-block')
const CID = require('cids')
const codecName = require('multicodec/src/name-table')
const { getName } = require('multicodec')
const vd = require('varint-decoder')
const multihashing = require('multihashing-async')
const { isMapEqual } = require('../../utils')
Expand Down Expand Up @@ -159,7 +159,7 @@ BitswapMessage.deserialize = async (raw) => {
const hashAlg = values[2]
// const hashLen = values[3] // We haven't need to use this so far
const hash = await multihashing(p.data, hashAlg)
const cid = new CID(cidVersion, codecName[multicodec.toString('16')], hash)
const cid = new CID(cidVersion, getName(multicodec), hash)
msg.addBlock(new Block(p.data, cid))
}))
return msg
Expand Down

0 comments on commit 579ddb5

Please sign in to comment.