Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-cid
Commits
95a7ed42
Unverified
Commit
95a7ed42
authored
May 25, 2020
by
Steven Allen
Committed by
GitHub
May 25, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #104 from rvagg/rvagg/filecoin-codecs
feat: add Filecoin multicodecs
parents
a25d68f3
8dd6fe27
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
83 deletions
+91
-83
cid.go
cid.go
+67
-61
cid_test.go
cid_test.go
+24
-22
No files found.
cid.go
View file @
95a7ed42
...
...
@@ -75,6 +75,8 @@ const (
DecredTx
=
0xe1
DashBlock
=
0xf0
DashTx
=
0xf1
FilCommitmentUnsealed
=
0xf101
FilCommitmentSealed
=
0xf102
)
// Codecs maps the name of a codec to its type
...
...
@@ -102,6 +104,8 @@ var Codecs = map[string]uint64{
"decred-tx"
:
DecredTx
,
"dash-block"
:
DashBlock
,
"dash-tx"
:
DashTx
,
"fil-commitment-unsealed"
:
FilCommitmentUnsealed
,
"fil-commitment-sealed"
:
FilCommitmentSealed
,
}
// CodecToStr maps the numeric codec to its name
...
...
@@ -127,6 +131,8 @@ var CodecToStr = map[uint64]string{
DecredTx
:
"decred-tx"
,
DashBlock
:
"dash-block"
,
DashTx
:
"dash-tx"
,
FilCommitmentUnsealed
:
"fil-commitment-unsealed"
,
FilCommitmentSealed
:
"fil-commitment-sealed"
,
}
// tryNewCidV0 tries to convert a multihash into a CIDv0 CID and returns an
...
...
cid_test.go
View file @
95a7ed42
...
...
@@ -38,6 +38,8 @@ var tCodecs = map[uint64]string{
DecredTx
:
"decred-tx"
,
DashBlock
:
"dash-block"
,
DashTx
:
"dash-tx"
,
FilCommitmentUnsealed
:
"fil-commitment-unsealed"
,
FilCommitmentSealed
:
"fil-commitment-sealed"
,
}
func
assertEqual
(
t
*
testing
.
T
,
a
,
b
Cid
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment