This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-13
lines changed Expand file tree Collapse file tree 2 files changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -56,16 +56,9 @@ module.exports = function block (self) {
5656
5757 const mhtype = options . mhtype || 'sha2-256'
5858 const format = options . format || 'dag-pb'
59- let cidVersion
59+ const cidVersion = options . version == null ? 1 : options . version
6060 // const mhlen = options.mhlen || 0
6161
62- if ( options . version == null ) {
63- // Pick appropriate CID version
64- cidVersion = mhtype === 'sha2-256' && format === 'dag-pb' ? 0 : 1
65- } else {
66- cidVersion = options . version
67- }
68-
6962 multihashing ( block , mhtype , ( err , multihash ) => {
7063 if ( err ) {
7164 return cb ( err )
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ const dagPB = require('ipld-dag-pb')
88const DAGNode = dagPB . DAGNode
99const DAGLink = dagPB . DAGLink
1010const CID = require ( 'cids' )
11- const mh = require ( 'multihashes' )
1211const Unixfs = require ( 'ipfs-unixfs' )
1312const errCode = require ( 'err-code' )
1413
@@ -50,7 +49,7 @@ function parseJSONBuffer (buf, callback) {
5049 return new DAGLink (
5150 link . Name || link . name ,
5251 link . Size || link . size ,
53- mh . fromB58String ( link . Hash || link . hash || link . multihash )
52+ link . Hash || link . hash || link . multihash
5453 )
5554 } )
5655 data = Buffer . from ( parsed . Data )
@@ -88,7 +87,7 @@ module.exports = function object (self) {
8887 }
8988
9089 self . _ipld . put ( node , {
91- version : 0 ,
90+ version : 1 ,
9291 hashAlg : 'sha2-256' ,
9392 format : 'dag-pb'
9493 } , ( err , cid ) => {
@@ -138,7 +137,7 @@ module.exports = function object (self) {
138137 }
139138
140139 self . _ipld . put ( node , {
141- version : 0 ,
140+ version : 1 ,
142141 hashAlg : 'sha2-256' ,
143142 format : 'dag-pb'
144143 } , ( err , cid ) => {
@@ -201,7 +200,7 @@ module.exports = function object (self) {
201200
202201 function next ( ) {
203202 self . _ipld . put ( node , {
204- version : 0 ,
203+ version : 1 ,
205204 hashAlg : 'sha2-256' ,
206205 format : 'dag-pb'
207206 } , ( err , cid ) => {
You can’t perform that action at this time.
0 commit comments