Fix debug_advance

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-06-23 20:29:58 +02:00
parent 2165728088
commit 1f967c6f63
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA

View File

@ -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)