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

Use passed CID version option when writing to storage #185

Merged
merged 1 commit into from
Sep 8, 2017

Conversation

alanshaw
Copy link
Contributor

@alanshaw alanshaw commented Sep 8, 2017

Necessary because:

If I put an object using a CIDv0 with the ipld resolver I have to retrieve it using a CIDv0, I can’t use CIDv1, even if the multihash and the codec are the same.

This is because the key for the data in the repo is derived from CID.buffer

See https://github.com/ipld/js-cid/blob/master/src/index.js#L115-L128
And https://github.com/ipfs/js-ipfs-repo/blob/master/src/blockstore.js#L29-L31


if (options.cidVersion === 1) {
cid = cid.toV1()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@daviddias daviddias merged commit 0cd2d60 into ipfs-inactive:master Sep 8, 2017
@alanshaw alanshaw deleted the write-with-cidv1-1 branch September 8, 2017 11:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants