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) {
56
56
57
57
const mhtype = options . mhtype || 'sha2-256'
58
58
const format = options . format || 'dag-pb'
59
- let cidVersion
59
+ const cidVersion = options . version == null ? 1 : options . version
60
60
// const mhlen = options.mhlen || 0
61
61
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
-
69
62
multihashing ( block , mhtype , ( err , multihash ) => {
70
63
if ( err ) {
71
64
return cb ( err )
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ const dagPB = require('ipld-dag-pb')
8
8
const DAGNode = dagPB . DAGNode
9
9
const DAGLink = dagPB . DAGLink
10
10
const CID = require ( 'cids' )
11
- const mh = require ( 'multihashes' )
12
11
const Unixfs = require ( 'ipfs-unixfs' )
13
12
const errCode = require ( 'err-code' )
14
13
@@ -50,7 +49,7 @@ function parseJSONBuffer (buf, callback) {
50
49
return new DAGLink (
51
50
link . Name || link . name ,
52
51
link . Size || link . size ,
53
- mh . fromB58String ( link . Hash || link . hash || link . multihash )
52
+ link . Hash || link . hash || link . multihash
54
53
)
55
54
} )
56
55
data = Buffer . from ( parsed . Data )
@@ -88,7 +87,7 @@ module.exports = function object (self) {
88
87
}
89
88
90
89
self . _ipld . put ( node , {
91
- version : 0 ,
90
+ version : 1 ,
92
91
hashAlg : 'sha2-256' ,
93
92
format : 'dag-pb'
94
93
} , ( err , cid ) => {
@@ -138,7 +137,7 @@ module.exports = function object (self) {
138
137
}
139
138
140
139
self . _ipld . put ( node , {
141
- version : 0 ,
140
+ version : 1 ,
142
141
hashAlg : 'sha2-256' ,
143
142
format : 'dag-pb'
144
143
} , ( err , cid ) => {
@@ -201,7 +200,7 @@ module.exports = function object (self) {
201
200
202
201
function next ( ) {
203
202
self . _ipld . put ( node , {
204
- version : 0 ,
203
+ version : 1 ,
205
204
hashAlg : 'sha2-256' ,
206
205
format : 'dag-pb'
207
206
} , ( err , cid ) => {
You can’t perform that action at this time.
0 commit comments