Skip to content

Commit

Permalink
Fix debug_advance
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Sztandera <[email protected]>
  • Loading branch information
Jakub Sztandera committed Jun 23, 2020
1 parent 2165728 commit 1f967c6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion cmd/lotus/debug_advance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1f967c6

Please sign in to comment.