Use beacon entries in advance-block

This commit is contained in:
Aayush Rajasekaran 2020-08-27 21:38:51 -04:00
parent 5aa90b0478
commit bed7158212

View File

@ -60,7 +60,9 @@ func init() {
} }
} }
// TODO: beacon
mbi, err := api.MinerGetBaseInfo(ctx, addr, head.Height()+1, head.Key())
ep := &types.ElectionProof{} ep := &types.ElectionProof{}
ep.WinCount = ep.ComputeWinCount(types.NewInt(1), types.NewInt(1)) ep.WinCount = ep.ComputeWinCount(types.NewInt(1), types.NewInt(1))
for ep.WinCount == 0 { for ep.WinCount == 0 {
@ -75,7 +77,7 @@ func init() {
uts := head.MinTimestamp() + uint64(build.BlockDelaySecs) uts := head.MinTimestamp() + uint64(build.BlockDelaySecs)
nheight := head.Height() + 1 nheight := head.Height() + 1
blk, err := api.MinerCreateBlock(ctx, &lapi.BlockTemplate{ blk, err := api.MinerCreateBlock(ctx, &lapi.BlockTemplate{
addr, head.Key(), ticket, ep, nil, msgs, nheight, uts, gen.ValidWpostForTesting, addr, head.Key(), ticket, ep, mbi.BeaconEntries, msgs, nheight, uts, gen.ValidWpostForTesting,
}) })
if err != nil { if err != nil {
return xerrors.Errorf("creating block: %w", err) return xerrors.Errorf("creating block: %w", err)