Merge pull request #2419 from filecoin-project/schomatis/fix/newtipset/mismatch-lengths
fix: NewTipSet: check mismatch in number of parents
This commit is contained in:
commit
6b9fd74f8e
@ -112,6 +112,10 @@ func NewTipSet(blks []*BlockHeader) (*TipSet, error) {
|
|||||||
return nil, fmt.Errorf("cannot create tipset with mismatching heights")
|
return nil, fmt.Errorf("cannot create tipset with mismatching heights")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(blks[0].Parents) != len(b.Parents) {
|
||||||
|
return nil, fmt.Errorf("cannot create tipset with mismatching number of parents")
|
||||||
|
}
|
||||||
|
|
||||||
for i, cid := range b.Parents {
|
for i, cid := range b.Parents {
|
||||||
if cid != blks[0].Parents[i] {
|
if cid != blks[0].Parents[i] {
|
||||||
return nil, fmt.Errorf("cannot create tipset with mismatching parents")
|
return nil, fmt.Errorf("cannot create tipset with mismatching parents")
|
||||||
|
Loading…
Reference in New Issue
Block a user