Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Commit

Permalink
refactor: remove eth-hash-to-cid module
Browse files Browse the repository at this point in the history
The eth-hash-to-cid is a module that is no longer used by any
project. Hence replace it with two simple lines of code.
  • Loading branch information
vmx committed Nov 7, 2018
1 parent 240c868 commit be77abd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"bitcoinjs-lib": "^4.0.2",
"chai": "^4.2.0",
"dirty-chai": "^2.0.1",
"eth-hash-to-cid": "~0.1.1",
"ethereumjs-block": "^2.1.0",
"ipld-bitcoin": "~0.1.8",
"ipld-ethereum": "^2.0.1",
Expand Down
7 changes: 5 additions & 2 deletions test/ipld-eth.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ const ipldEthBlock = require('ipld-ethereum').ethBlock
const ipldEthStateTrie = require('ipld-ethereum').ethStateTrie
const loadFixture = require('aegir/fixtures')
const async = require('async')
const cidForHash = require('eth-hash-to-cid')
const EthBlockHeader = require('ethereumjs-block/header')
const EthTrieNode = require('merkle-patricia-tree/trieNode')
const multihashes = require('multihashes')
const CID = require('cids')

const IPLDResolver = require('../src')

Expand Down Expand Up @@ -76,10 +77,12 @@ module.exports = (repo) => {
default: throw new Error('Unknown type!')
}

const multihash = multihashes.encode(node.hash(), 'keccak-256')
const cid = new CID(1, type, multihash)
return {
raw: rawData,
node: node,
cid: cidForHash(type, node.hash())
cid: cid
}
}

Expand Down

0 comments on commit be77abd

Please sign in to comment.