Skip to content
This repository was archived by the owner on Aug 12, 2020. It is now read-only.

Commit c2e38ae

Browse files
committed
fix: do not overwrite cid property of DAGNodes
1 parent d43aa5e commit c2e38ae

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/builder/builder.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,17 @@ module.exports = function builder (createChunker, ipld, createReducer, _options)
7777
return cb(null, node)
7878
}
7979

80-
node.cid = new CID(options.cidVersion, 'dag-pb', node.multihash)
80+
const cid = new CID(options.cidVersion, 'dag-pb', node.multihash)
81+
82+
node = new DAGNode(
83+
node.data,
84+
node.links,
85+
node.serialized,
86+
cid
87+
)
8188

8289
ipld.put(node, {
83-
cid: node.cid
90+
cid
8491
}, (err) => cb(err, node))
8592
}
8693
], (err, node) => {

0 commit comments

Comments
 (0)