check parent height

This commit is contained in:
Lucas Molas 2020-08-04 14:44:27 -03:00
parent c0c692fa22
commit 9f82e98f28

View File

@ -226,5 +226,9 @@ func (ts *TipSet) Contains(oc cid.Cid) bool {
}
func (ts *TipSet) IsChildOf(parent *TipSet) bool {
return CidArrsEqual(ts.Parents().Cids(), parent.Cids())
return CidArrsEqual(ts.Parents().Cids(), parent.Cids()) &&
// FIXME: The height check might go beyond what is meant by
// "parent", but many parts of the code rely on the tipset's
// height for their processing logic at the moment to obviate it.
ts.height > parent.height
}