make state diffing work with partial state trees

This commit is contained in:
Steven Allen 2020-10-05 17:02:43 -07:00
parent 89b88c1e0d
commit 16243b97aa

View File

@ -233,8 +233,13 @@ func writeStateToTempCAR(bs blockstore.Blockstore, roots ...cid.Cid) (string, er
if link.Cid.Prefix().Codec == cid.FilCommitmentSealed || link.Cid.Prefix().Codec == cid.FilCommitmentUnsealed {
continue
}
// ignore things we don't have, the state tree is incomplete.
if has, err := bs.Has(link.Cid); err != nil {
return nil, err
} else if has {
out = append(out, link)
}
}
return out, nil
}