From cced3bf9ee9cc9c51e72c85b06aa14ba44ddbb22 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Tue, 20 Oct 2020 17:45:03 +0200 Subject: [PATCH] Randomize seed Signed-off-by: Jakub Sztandera --- cmd/lotus-shed/election.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/lotus-shed/election.go b/cmd/lotus-shed/election.go index bc053dea4..ffe30d163 100644 --- a/cmd/lotus-shed/election.go +++ b/cmd/lotus-shed/election.go @@ -3,6 +3,7 @@ package main import ( "encoding/binary" "fmt" + "math/rand" "github.com/filecoin-project/lotus/chain/types" lcli "github.com/filecoin-project/lotus/cli" @@ -30,7 +31,7 @@ var electionRunDummy = &cli.Command{ }, &cli.Uint64Flag{ Name: "seed", - Value: 4, + Value: 0, }, }, Action: func(cctx *cli.Context) error { @@ -46,7 +47,11 @@ var electionRunDummy = &cli.Command{ ep := &types.ElectionProof{} ep.VRFProof = make([]byte, 32) - binary.BigEndian.PutUint64(ep.VRFProof, cctx.Uint64("seed")) + seed := cctx.Uint64("seed") + if seed == 0 { + seed = rand.Uint64() + } + binary.BigEndian.PutUint64(ep.VRFProof, seed) i := uint64(0) for {