Merge branch 'master' into feat/event-states

This commit is contained in:
Łukasz Magiera 2020-01-16 03:55:12 +01:00
commit 0aebec6697
7 changed files with 25 additions and 12 deletions

View File

@ -14,7 +14,7 @@ MODULES:=
CLEAN:= CLEAN:=
BINS:= BINS:=
GOFLAGS+=-ldflags="-X "github.com/filecoin-project/lotus/build".CurrentCommit=+git$(subst -,.,$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null))" GOFLAGS+=-ldflags='-X="github.com/filecoin-project/lotus/build".CurrentCommit=+git$(subst -,.,$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null))'
## FFI ## FFI

View File

@ -116,6 +116,10 @@ func (w *worker) processTask(ctx context.Context, task sectorbuilder.WorkerTask)
if err := w.push("cache", task.SectorID); err != nil { if err := w.push("cache", task.SectorID); err != nil {
return errRes(xerrors.Errorf("pushing precommited data: %w", err)) return errRes(xerrors.Errorf("pushing precommited data: %w", err))
} }
if err := w.remove("staging", task.SectorID); err != nil {
return errRes(xerrors.Errorf("cleaning up staged sector: %w", err))
}
case sectorbuilder.WorkerCommit: case sectorbuilder.WorkerCommit:
proof, err := w.sb.SealCommit(ctx, task.SectorID, task.SealTicket, task.SealSeed, task.Pieces, task.Rspco) proof, err := w.sb.SealCommit(ctx, task.SectorID, task.SealTicket, task.SealSeed, task.Pieces, task.Rspco)
if err != nil { if err != nil {
@ -127,6 +131,10 @@ func (w *worker) processTask(ctx context.Context, task sectorbuilder.WorkerTask)
if err := w.push("cache", task.SectorID); err != nil { if err := w.push("cache", task.SectorID); err != nil {
return errRes(xerrors.Errorf("pushing precommited data: %w", err)) return errRes(xerrors.Errorf("pushing precommited data: %w", err))
} }
if err := w.remove("sealed", task.SectorID); err != nil {
return errRes(xerrors.Errorf("cleaning up sealed sector: %w", err))
}
} }
return res return res

View File

@ -125,6 +125,11 @@ func (w *worker) push(typ string, sectorID uint64) error {
} }
// TODO: keep files around for later stages of sealing // TODO: keep files around for later stages of sealing
return w.remove(typ, sectorID)
}
func (w *worker) remove(typ string, sectorID uint64) error {
filename := filepath.Join(w.repo, typ, w.sb.SectorName(sectorID))
return os.RemoveAll(filename) return os.RemoveAll(filename)
} }

View File

@ -557,7 +557,7 @@ func createStorageMiner(ctx context.Context, api lapi.FullNode, peerid peer.ID,
createStorageMinerMsg := &types.Message{ createStorageMinerMsg := &types.Message{
To: actors.StoragePowerAddress, To: actors.StoragePowerAddress,
From: owner, From: owner,
Value: collateral, Value: types.BigAdd(collateral, types.BigDiv(collateral, types.NewInt(100))),
Method: actors.SPAMethods.CreateStorageMiner, Method: actors.SPAMethods.CreateStorageMiner,
Params: params, Params: params,

View File

@ -3,19 +3,19 @@ package storage
import ( import (
"context" "context"
"errors" "errors"
"github.com/filecoin-project/lotus/chain/events"
"time" "time"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-sectorbuilder"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
logging "github.com/ipfs/go-log/v2" logging "github.com/ipfs/go-log/v2"
"github.com/libp2p/go-libp2p-core/host" "github.com/libp2p/go-libp2p-core/host"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-sectorbuilder"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/events"
"github.com/filecoin-project/lotus/chain/gen" "github.com/filecoin-project/lotus/chain/gen"
"github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/store"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"

View File

@ -1,8 +1,9 @@
package sealing package sealing
import ( import (
"github.com/filecoin-project/lotus/api"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/api"
) )
type mutator interface { type mutator interface {

View File

@ -2,17 +2,16 @@ package sealing
import ( import (
"context" "context"
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/namespace"
"io" "io"
"github.com/filecoin-project/lotus/lib/padreader"
logging "github.com/ipfs/go-log/v2"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-sectorbuilder" "github.com/filecoin-project/go-sectorbuilder"
"github.com/filecoin-project/lotus/lib/padreader"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/namespace"
logging "github.com/ipfs/go-log/v2"
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/events"