Merge pull request #4056 from zgfzgf/tipset-equals

optimize Tipset equals
This commit is contained in:
Jakub Sztandera 2020-09-28 20:15:54 +02:00 committed by GitHub
commit 2633198e6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
} }
} }