Merge pull request #277 from filecoin-project/fix/bitfield-deterministic

Sort the result of All in bitfiled
This commit is contained in:
Łukasz Magiera 2019-10-04 20:25:55 +02:00 committed by GitHub
commit 7f1c90cc7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@ package types
import (
"fmt"
"io"
"sort"
"github.com/filecoin-project/go-lotus/extern/rleplus"
cbg "github.com/whyrusleeping/cbor-gen"
@ -47,6 +48,8 @@ func (bf BitField) All() []uint64 {
for i := range bf.bits {
res = append(res, i)
}
sort.Slice(res, func(i, j int) bool { return res[i] < res[j] })
return res
}