WIP: update sectorbuilder

This commit is contained in:
whyrusleeping
2020-02-26 14:54:34 -08:00
parent cb09e48e8c
commit 767392332e
18 changed files with 142 additions and 1010 deletions
+2 -4
View File
@@ -456,7 +456,7 @@ create temp table mh (like miner_heads excluding constraints) on commit drop;
return xerrors.Errorf("prep temp: %w", err)
}
stmt, err := tx.Prepare(`copy mh (head, addr, stateroot, sectorset, setsize, provingset, provingsize, owner, worker, peerid, sectorsize, power, active, ppe, slashed_at) from STDIN`)
stmt, err := tx.Prepare(`copy mh (head, addr, stateroot, sectorset, setsize, provingset, provingsize, owner, worker, peerid, sectorsize, power, ppe) from STDIN`)
if err != nil {
return err
}
@@ -473,10 +473,8 @@ create temp table mh (like miner_heads excluding constraints) on commit drop;
i.info.Worker.String(),
i.info.PeerId.String(),
i.info.SectorSize,
i.state.Power.String(), // TODO: SPA
i.state.Active,
i.power.String(), // TODO: SPA
i.state.PoStState.ProvingPeriodStart,
i.state.SlashedAt,
); err != nil {
return err
}
+12 -2
View File
@@ -5,13 +5,15 @@ import (
"container/list"
"context"
"encoding/json"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"math"
"sync"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/abi/big"
"github.com/ipfs/go-cid"
@@ -56,6 +58,7 @@ type minerInfo struct {
state miner.State
info miner.MinerInfo
power big.Int
ssize uint64
psize uint64
}
@@ -268,6 +271,13 @@ func syncHead(ctx context.Context, api api.FullNode, st *storage, ts *types.TipS
par(50, kvmaparr(miners), func(it func() (minerKey, *minerInfo)) {
k, info := it()
pow, err := api.StateMinerPower(ctx, k.addr, types.EmptyTSK)
if err != nil {
log.Error(err)
// Not sure why this would fail, but its probably worth continuing
}
info.power = pow.MinerPower
sszs, err := api.StateMinerSectorCount(ctx, k.addr, types.EmptyTSK)
if err != nil {
log.Error(err)
+1 -1
View File
@@ -268,7 +268,7 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
Owner: owner, // TODO: That is useful
Worker: owner,
SectorSize: abi.SectorSize(ssize),
Peer: peer.ID("SETME"),
Peer: peer.ID("SETME"),
})
if err != nil {
w.WriteHeader(400)