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
75d3ffe5
Unverified
Commit
75d3ffe5
authored
Jul 23, 2018
by
Steven Allen
Committed by
GitHub
Jul 23, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #58 from ipfs/feat/decred-codec
Add Decred codecs
parents
bd441bb4
8028fee0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
cid.go
cid.go
+6
-0
cid_test.go
cid_test.go
+2
-0
No files found.
cid.go
View file @
75d3ffe5
...
@@ -77,6 +77,8 @@ const (
...
@@ -77,6 +77,8 @@ const (
BitcoinTx
=
0xb1
BitcoinTx
=
0xb1
ZcashBlock
=
0xc0
ZcashBlock
=
0xc0
ZcashTx
=
0xc1
ZcashTx
=
0xc1
DecredBlock
=
0xe0
DecredTx
=
0xe1
)
)
// Codecs maps the name of a codec to its type
// Codecs maps the name of a codec to its type
...
@@ -99,6 +101,8 @@ var Codecs = map[string]uint64{
...
@@ -99,6 +101,8 @@ var Codecs = map[string]uint64{
"bitcoin-tx"
:
BitcoinTx
,
"bitcoin-tx"
:
BitcoinTx
,
"zcash-block"
:
ZcashBlock
,
"zcash-block"
:
ZcashBlock
,
"zcash-tx"
:
ZcashTx
,
"zcash-tx"
:
ZcashTx
,
"decred-block"
:
DecredBlock
,
"decred-tx"
:
DecredTx
,
}
}
// CodecToStr maps the numeric codec to its name
// CodecToStr maps the numeric codec to its name
...
@@ -120,6 +124,8 @@ var CodecToStr = map[uint64]string{
...
@@ -120,6 +124,8 @@ var CodecToStr = map[uint64]string{
BitcoinTx
:
"bitcoin-tx"
,
BitcoinTx
:
"bitcoin-tx"
,
ZcashBlock
:
"zcash-block"
,
ZcashBlock
:
"zcash-block"
,
ZcashTx
:
"zcash-tx"
,
ZcashTx
:
"zcash-tx"
,
DecredBlock
:
"decred-block"
,
DecredTx
:
"decred-tx"
,
}
}
// NewCidV0 returns a Cid-wrapped multihash.
// NewCidV0 returns a Cid-wrapped multihash.
...
...
cid_test.go
View file @
75d3ffe5
...
@@ -33,6 +33,8 @@ var tCodecs = map[uint64]string{
...
@@ -33,6 +33,8 @@ var tCodecs = map[uint64]string{
BitcoinTx
:
"bitcoin-tx"
,
BitcoinTx
:
"bitcoin-tx"
,
ZcashBlock
:
"zcash-block"
,
ZcashBlock
:
"zcash-block"
,
ZcashTx
:
"zcash-tx"
,
ZcashTx
:
"zcash-tx"
,
DecredBlock
:
"decred-block"
,
DecredTx
:
"decred-tx"
,
}
}
func
assertEqual
(
t
*
testing
.
T
,
a
,
b
*
Cid
)
{
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