use CidV1 and raw multicodec as default
This commit is contained in:
parent
e2a6003ddd
commit
10844c0bd5
|
@ -7,12 +7,11 @@
|
||||||
## This file may not be copied, modified, or distributed except according to
|
## This file may not be copied, modified, or distributed except according to
|
||||||
## those terms.
|
## those terms.
|
||||||
|
|
||||||
import pkg/libp2p/multihash
|
{.push raises: [Defect].}
|
||||||
import pkg/libp2p/multicodec
|
|
||||||
import pkg/libp2p/cid
|
|
||||||
import pkg/stew/byteutils
|
|
||||||
|
|
||||||
export cid, multihash, multicodec
|
import pkg/libp2p
|
||||||
|
import pkg/questionable
|
||||||
|
import pkg/stew/byteutils
|
||||||
|
|
||||||
type
|
type
|
||||||
CidDontMatchError* = object of CatchableError
|
CidDontMatchError* = object of CatchableError
|
||||||
|
@ -46,9 +45,9 @@ proc new*(
|
||||||
proc new*(
|
proc new*(
|
||||||
T: type Block,
|
T: type Block,
|
||||||
data: openArray[byte] = [],
|
data: openArray[byte] = [],
|
||||||
version = CIDv0,
|
version = CIDv1,
|
||||||
hcodec = multiCodec("sha2-256"),
|
hcodec = multiCodec("sha2-256"),
|
||||||
codec = multiCodec("dag-pb")): T =
|
codec = multiCodec("raw")): T =
|
||||||
let hash = MultiHash.digest($hcodec, data).get()
|
let hash = MultiHash.digest($hcodec, data).get()
|
||||||
Block(
|
Block(
|
||||||
cid: Cid.init(version, codec, hash).get(),
|
cid: Cid.init(version, codec, hash).get(),
|
||||||
|
|
Loading…
Reference in New Issue