if it's not a dag, it's not a block

This commit is contained in:
vyzo 2021-07-03 12:08:40 +03:00
parent 8157f889ce
commit 9d6cabd18a

View File

@ -674,6 +674,10 @@ func (s *SplitStore) isVMCopyContext() bool {
}
func (s *SplitStore) isBlockHeader(c cid.Cid) (isBlock bool, err error) {
if c.Prefix().Codec != cid.DagCBOR {
return false, nil
}
err = s.view(c, func(data []byte) error {
var hdr types.BlockHeader
isBlock = hdr.UnmarshalCBOR(bytes.NewBuffer(data)) == nil