use internal version of has for occurs checks

This commit is contained in:
vyzo 2021-07-05 12:41:11 +03:00
parent d8b8d75e0f
commit 0b7153be86

View File

@ -1231,7 +1231,7 @@ func (s *SplitStore) walkObjectIncomplete(c cid.Cid, walked *cid.Set, f, missing
// occurs check -- only for DAGs
if c.Prefix().Codec == cid.DagCBOR {
has, err := s.hot.Has(c)
has, err := s.has(c)
if err != nil {
return xerrors.Errorf("error occur checking %s: %w", c, err)
}
@ -1291,6 +1291,16 @@ func (s *SplitStore) view(cid cid.Cid, cb func([]byte) error) error {
}
}
func (s *SplitStore) has(c cid.Cid) (bool, error) {
has, err := s.hot.Has(c)
if has || err != nil {
return has, err
}
return s.cold.Has(c)
}
func (s *SplitStore) isOldBlockHeader(c cid.Cid, epoch abi.ChainEpoch) (isOldBlock bool, err error) {
if c.Prefix().Codec != cid.DagCBOR {
return false, nil