Merge pull request #484 from hfmhx/master

fix NewTipSet
This commit is contained in:
Whyrusleeping 2019-10-31 09:53:56 -07:00 committed by GitHub
commit 44710ca4e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,9 +74,15 @@ func NewTipSet(blks []*BlockHeader) (*TipSet, error) {
if b.Height != blks[0].Height { if b.Height != blks[0].Height {
return nil, fmt.Errorf("cannot create tipset with mismatching heights") return nil, fmt.Errorf("cannot create tipset with mismatching heights")
} }
for i, cid := range b.Parents {
if cid != blks[0].Parents[i] {
return nil, fmt.Errorf("cannot create tipset with mismatching parents")
}
}
ts.cids = append(ts.cids, b.Cid()) ts.cids = append(ts.cids, b.Cid())
// TODO: ensure the same parents
} }
ts.height = blks[0].Height ts.height = blks[0].Height