This commit is contained in:
Dmitriy Ryajov 2022-03-14 20:37:59 -06:00
parent 071a748766
commit 5eabafac03
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4

View File

@ -39,15 +39,17 @@ func init*(
hash = ? MultiHash.digest($mcodec, data).mapFailure
cid = ? Cid.init(version, codec, hash).mapFailure
success Block(
# TODO: If the hash is `>=` to the data,
# use the Cid as a container!
Block(
cid: cid,
data: @data)
data: @data).success
func init*(
T: type Block,
cid: Cid,
data: openArray[byte],
verify: bool = false): ?!T =
verify: bool = true): ?!T =
let
mhash = ? cid.mhash.mapFailure