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

This commit is contained in:
vyzo
2021-07-04 18:38:28 +03:00
parent 8157f889ce
commit 9d6cabd18a
+4
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