worker: Paramfetch once
This commit is contained in:
parent
1a9c775407
commit
63af9f2a9e
@ -4,6 +4,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
paramfetch "github.com/filecoin-project/go-paramfetch"
|
||||||
"github.com/filecoin-project/go-sectorbuilder"
|
"github.com/filecoin-project/go-sectorbuilder"
|
||||||
"github.com/mitchellh/go-homedir"
|
"github.com/mitchellh/go-homedir"
|
||||||
|
|
||||||
@ -11,12 +12,13 @@ import (
|
|||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
"gopkg.in/urfave/cli.v2"
|
"gopkg.in/urfave/cli.v2"
|
||||||
|
|
||||||
|
manet "github.com/multiformats/go-multiaddr-net"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
lcli "github.com/filecoin-project/lotus/cli"
|
lcli "github.com/filecoin-project/lotus/cli"
|
||||||
"github.com/filecoin-project/lotus/lib/lotuslog"
|
"github.com/filecoin-project/lotus/lib/lotuslog"
|
||||||
"github.com/filecoin-project/lotus/node/repo"
|
"github.com/filecoin-project/lotus/node/repo"
|
||||||
manet "github.com/multiformats/go-multiaddr-net"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = logging.Logger("main")
|
var log = logging.Logger("main")
|
||||||
@ -132,6 +134,10 @@ var runCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := paramfetch.GetParams(build.ParametersJson(), ssize); err != nil {
|
||||||
|
return xerrors.Errorf("get params: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
sb, err := sectorbuilder.NewStandalone(§orbuilder.Config{
|
sb, err := sectorbuilder.NewStandalone(§orbuilder.Config{
|
||||||
SectorSize: ssize,
|
SectorSize: ssize,
|
||||||
Miner: act,
|
Miner: act,
|
||||||
|
@ -4,12 +4,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
paramfetch "github.com/filecoin-project/go-paramfetch"
|
|
||||||
"github.com/filecoin-project/go-sectorbuilder"
|
"github.com/filecoin-project/go-sectorbuilder"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
lapi "github.com/filecoin-project/lotus/api"
|
lapi "github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type worker struct {
|
type worker struct {
|
||||||
@ -23,10 +21,6 @@ type worker struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func acceptJobs(ctx context.Context, api lapi.StorageMiner, sb *sectorbuilder.SectorBuilder, limiter *limits, endpoint string, auth http.Header, repo string, noprecommit, nocommit bool) error {
|
func acceptJobs(ctx context.Context, api lapi.StorageMiner, sb *sectorbuilder.SectorBuilder, limiter *limits, endpoint string, auth http.Header, repo string, noprecommit, nocommit bool) error {
|
||||||
if err := paramfetch.GetParams(build.ParametersJson(), sb.SectorSize()); err != nil {
|
|
||||||
return xerrors.Errorf("get params: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
w := &worker{
|
w := &worker{
|
||||||
api: api,
|
api: api,
|
||||||
minerEndpoint: endpoint,
|
minerEndpoint: endpoint,
|
||||||
|
Loading…
Reference in New Issue
Block a user