Merge pull request #4056 from zgfzgf/tipset-equals
optimize Tipset equals
This commit is contained in:
commit
2633198e6c
@ -167,12 +167,16 @@ func (ts *TipSet) Equals(ots *TipSet) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(ts.blks) != len(ots.blks) {
|
if ts.height != ots.height {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, b := range ts.blks {
|
if len(ts.cids) != len(ots.cids) {
|
||||||
if b.Cid() != ots.blks[i].Cid() {
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, cid := range ts.cids {
|
||||||
|
if cid != ots.cids[i] {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user