Skip to content

Commit

Permalink
fix NewTipSet
Browse files Browse the repository at this point in the history
  • Loading branch information
hans authored and hfmhx committed Oct 31, 2019
1 parent 705637b commit 6c4537f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion chain/types/tipset.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,15 @@ func NewTipSet(blks []*BlockHeader) (*TipSet, error) {
if b.Height != blks[0].Height {
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())

// TODO: ensure the same parents
}
ts.height = blks[0].Height

Expand Down

0 comments on commit 6c4537f

Please sign in to comment.