ipld-eth-statedb/internal/util.go
Roy Crihfield 88e7a394d0 Fix node resolution; use Cid struct as key
was erroneously storing the cid in the fullNode's flag.cache
2023-04-24 18:34:49 +08:00

15 lines
298 B
Go

package internal
import (
"github.com/ipfs/go-cid"
"github.com/multiformats/go-multihash"
)
func Keccak256ToCid(codec uint64, h []byte) (cid.Cid, error) {
buf, err := multihash.Encode(h, multihash.KECCAK_256)
if err != nil {
return cid.Cid{}, err
}
return cid.NewCidV1(codec, buf), nil
}