From 1f967c6f630ac1dc2d93588ce4a7655f54ba83c5 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Tue, 23 Jun 2020 20:29:58 +0200 Subject: [PATCH] Fix debug_advance Signed-off-by: Jakub Sztandera --- cmd/lotus/debug_advance.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cmd/lotus/debug_advance.go b/cmd/lotus/debug_advance.go index 2782ea074..2607f0c99 100644 --- a/cmd/lotus/debug_advance.go +++ b/cmd/lotus/debug_advance.go @@ -3,6 +3,9 @@ package main import ( + "encoding/binary" + "time" + "github.com/filecoin-project/go-address" lapi "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" @@ -68,11 +71,21 @@ func init() { } // TODO: beacon + ep := &types.ElectionProof{} + ep.WinCount = ep.ComputeWinCount(types.NewInt(1), types.NewInt(1)) + for ep.WinCount == 0 { + fakeVrf := make([]byte, 8) + unixNow := uint64(time.Now().UnixNano()) + binary.LittleEndian.PutUint64(fakeVrf, unixNow) + + ep.VRFProof = fakeVrf + ep.WinCount = ep.ComputeWinCount(types.NewInt(1), types.NewInt(1)) + } uts := head.MinTimestamp() + uint64(build.BlockDelay) nheight := head.Height() + 1 blk, err := api.MinerCreateBlock(ctx, &lapi.BlockTemplate{ - addr, head.Key(), ticket, &types.ElectionProof{}, nil, msgs, nheight, uts, gen.ValidWpostForTesting, + addr, head.Key(), ticket, ep, nil, msgs, nheight, uts, gen.ValidWpostForTesting, }) if err != nil { return xerrors.Errorf("creating block: %w", err)