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-merkledag
Commits
b783f032
Commit
b783f032
authored
Oct 24, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement cbor ipld nodes and a first pass at the 'dag' command
License: MIT Signed-off-by:
Jeromy
<
why@ipfs.io
>
parent
ff1df7aa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
merkledag.go
merkledag.go
+7
-0
No files found.
merkledag.go
View file @
b783f032
...
@@ -14,6 +14,7 @@ import (
...
@@ -14,6 +14,7 @@ import (
logging
"gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
logging
"gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
node
"gx/ipfs/QmU7bFWQ793qmvNy7outdCaMfSDNk8uqhx4VNrxYj5fj5g/go-ipld-node"
node
"gx/ipfs/QmU7bFWQ793qmvNy7outdCaMfSDNk8uqhx4VNrxYj5fj5g/go-ipld-node"
cid
"gx/ipfs/QmXfiyr2RWEXpVDdaYnD2HNiBk6UBddsvEP4RPfXb6nGqY/go-cid"
cid
"gx/ipfs/QmXfiyr2RWEXpVDdaYnD2HNiBk6UBddsvEP4RPfXb6nGqY/go-cid"
ipldcbor
"gx/ipfs/QmYRzW9YDHVNCDbfFzbS7TEXAG1swE1yjq1basZ5WnJYH4/go-ipld-cbor"
)
)
var
log
=
logging
.
Logger
(
"merkledag"
)
var
log
=
logging
.
Logger
(
"merkledag"
)
...
@@ -105,6 +106,12 @@ func decodeBlock(b blocks.Block) (node.Node, error) {
...
@@ -105,6 +106,12 @@ func decodeBlock(b blocks.Block) (node.Node, error) {
return
decnd
,
nil
return
decnd
,
nil
case
cid
.
Raw
:
case
cid
.
Raw
:
return
NewRawNode
(
b
.
RawData
()),
nil
return
NewRawNode
(
b
.
RawData
()),
nil
case
cid
.
CBOR
:
return
ipldcbor
.
Decode
(
b
.
RawData
())
/*
case cid.Bitcoin:
return ipldbtc.DecodeBlock(b.RawData())
*/
default
:
default
:
return
nil
,
fmt
.
Errorf
(
"unrecognized object type: %s"
,
c
.
Type
())
return
nil
,
fmt
.
Errorf
(
"unrecognized object type: %s"
,
c
.
Type
())
}
}
...
...
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