Revert ticket compare function to comparing vrf hashes

This commit is contained in:
Łukasz Magiera 2020-04-01 17:17:05 +02:00 committed by Łukasz Magiera
parent 417d434973
commit cdd97ce959

View File

@ -10,6 +10,7 @@ import (
"github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log/v2" logging "github.com/ipfs/go-log/v2"
"github.com/minio/blake2b-simd"
cbg "github.com/whyrusleeping/cbor-gen" cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors" "golang.org/x/xerrors"
) )
@ -170,7 +171,9 @@ func (ts *TipSet) Equals(ots *TipSet) bool {
} }
func (t *Ticket) Less(o *Ticket) bool { func (t *Ticket) Less(o *Ticket) bool {
return bytes.Compare(t.VRFProof, o.VRFProof) < 0 tDigest := blake2b.Sum256(t.VRFProof)
oDigest := blake2b.Sum256(o.VRFProof)
return bytes.Compare(tDigest[:], oDigest[:]) < 0
} }
func (ts *TipSet) MinTicket() *Ticket { func (ts *TipSet) MinTicket() *Ticket {