This repository was archived by the owner on Feb 12, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
docs: update block api documentation #4124
docs: update block api documentation #4124
Changes from all commits
2b788a9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/ipfs/js-ipfs/blob/master/packages/ipfs-core-types/src/block/index.ts does not include this option. However, the
go-ipfs
CLI seems to support this option and found this mentions in this repository:js-ipfs/packages/ipfs-cli/src/commands/block/put.js
Lines 34 to 37 in 548cfb2
js-ipfs/packages/ipfs-http-server/src/api/resources/block.js
Line 111 in 548cfb2
js-ipfs
or onlygo-ipfs
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not supported by
js-ipfs
and I'm not clear on what it even does forgo-ipfs
. It defaults to-1
which means.. 🤷If you could find out the what and the why maybe we could even remove it entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it seems to be literally the multihash length, but doesn't seem to be very useful looking at the very limited search results. I tried figuring out if this was useful when opening this PR, but couldn't find anything that explained why it may be needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to refactor relevant go-ipfs code around this recently and can provide some details.
afaik the only place where this is used, is when
mhlen
gets passed deep into go-multihash code responsible for digert (Sum
) calculation: https://github.com/multiformats/go-multihash/blob/75ae3688857d036ea15947be9df68d3172b19470/sum.gotldr:
-1
is the implicit default which means "set length based on hashing function output"<=0
mhlen
allows for truncating longer digests produces by alternative hash functions