connect miner to full node , only when running markets
This commit is contained in:
parent
4f0a96c9c7
commit
3aa6d03cc1
@ -22,7 +22,6 @@ import (
|
||||
"github.com/filecoin-project/lotus/lib/ulimit"
|
||||
"github.com/filecoin-project/lotus/metrics"
|
||||
"github.com/filecoin-project/lotus/node"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
)
|
||||
@ -44,6 +43,11 @@ var runCmd = &cli.Command{
|
||||
Name: "nosync",
|
||||
Usage: "don't check full-node sync status",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "enable-markets",
|
||||
Usage: "",
|
||||
Value: true,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "manage-fdlimit",
|
||||
Usage: "manage open file limit",
|
||||
@ -143,14 +147,15 @@ var runCmd = &cli.Command{
|
||||
return xerrors.Errorf("getting API endpoint: %w", err)
|
||||
}
|
||||
|
||||
lr, _ := r.Lock(repo.StorageMiner)
|
||||
c, _ := lr.Config()
|
||||
cfg, ok := c.(*config.StorageMiner)
|
||||
if !ok {
|
||||
log.Fatalf("invalid config from repo, got: %T", c)
|
||||
}
|
||||
//lr, _ := r.Lock(repo.StorageMiner)
|
||||
//c, _ := lr.Config()
|
||||
//cfg, ok := c.(*config.StorageMiner)
|
||||
//if !ok {
|
||||
//log.Fatalf("invalid config from repo, got: %T", c)
|
||||
//}
|
||||
|
||||
if cfg.Subsystems.EnableStorageMarket {
|
||||
//if cfg.Subsystems.EnableStorageMarket {
|
||||
if cctx.Bool("enable-markets") {
|
||||
log.Infof("Bootstrapping libp2p network with full node")
|
||||
|
||||
// Bootstrap with full node
|
||||
@ -166,7 +171,7 @@ var runCmd = &cli.Command{
|
||||
log.Infof("No markets subsystem enabled, so no libp2p network bootstrapping")
|
||||
}
|
||||
|
||||
_ = lr.Close()
|
||||
//_ = lr.Close()
|
||||
|
||||
log.Infof("Remote version %s", v)
|
||||
|
||||
|
@ -46,11 +46,11 @@ func TestDealWithMarketAndMinerNode(t *testing.T) {
|
||||
|
||||
dh := kit.NewDealHarness(t, client, main, market)
|
||||
|
||||
runConcurrentDeals(t, dh, fullDealCyclesOpts{
|
||||
n: n,
|
||||
fastRetrieval: fastRetrieval,
|
||||
carExport: carExport,
|
||||
startEpoch: startEpoch,
|
||||
dh.RunConcurrentDeals(kit.RunConcurrentDealsOpts{
|
||||
N: n,
|
||||
FastRetrieval: fastRetrieval,
|
||||
CarExport: carExport,
|
||||
StartEpoch: startEpoch,
|
||||
})
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ func TestSimultenousTransferLimit(t *testing.T) {
|
||||
node.ApplyIf(node.IsType(repo.StorageMiner), node.Override(new(dtypes.StagingGraphsync), modules.StagingGraphsync(2))),
|
||||
))
|
||||
ens.InterconnectAll().BeginMining(blockTime)
|
||||
dh := kit.NewDealHarness(t, client, miner)
|
||||
dh := kit.NewDealHarness(t, client, miner, miner)
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
|
@ -28,7 +28,7 @@ func TestOfflineDealFlow(t *testing.T) {
|
||||
client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs())
|
||||
ens.InterconnectAll().BeginMining(blocktime)
|
||||
|
||||
dh := kit.NewDealHarness(t, client, miner)
|
||||
dh := kit.NewDealHarness(t, client, miner, miner)
|
||||
|
||||
// Create a random file and import on the client.
|
||||
res, inFile := client.CreateImportFile(ctx, 1, 0)
|
||||
|
@ -30,7 +30,7 @@ func TestFirstDealEnablesMining(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
dh := kit.NewDealHarness(t, &client, &provider)
|
||||
dh := kit.NewDealHarness(t, &client, &provider, &provider)
|
||||
|
||||
ref, _ := client.CreateImportFile(ctx, 5, 0)
|
||||
|
||||
|
@ -35,7 +35,7 @@ func TestQuotePriceForUnsealedRetrieval(t *testing.T) {
|
||||
err = miner.MarketSetRetrievalAsk(ctx, ask)
|
||||
require.NoError(t, err)
|
||||
|
||||
dh := kit.NewDealHarness(t, client, miner)
|
||||
dh := kit.NewDealHarness(t, client, miner, miner)
|
||||
|
||||
deal1, res1, _ := dh.MakeOnlineDeal(ctx, kit.MakeFullDealParams{Rseed: 6})
|
||||
|
||||
@ -123,7 +123,7 @@ func TestZeroPricePerByteRetrieval(t *testing.T) {
|
||||
err = miner.MarketSetRetrievalAsk(ctx, ask)
|
||||
require.NoError(t, err)
|
||||
|
||||
dh := kit.NewDealHarness(t, client, miner)
|
||||
dh := kit.NewDealHarness(t, client, miner, miner)
|
||||
dh.RunConcurrentDeals(kit.RunConcurrentDealsOpts{
|
||||
N: 1,
|
||||
StartEpoch: startEpoch,
|
||||
|
@ -38,7 +38,7 @@ func TestPublishDealsBatching(t *testing.T) {
|
||||
client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ConstructorOpts(opts))
|
||||
ens.InterconnectAll().BeginMining(10 * time.Millisecond)
|
||||
|
||||
dh := kit.NewDealHarness(t, client, miner)
|
||||
dh := kit.NewDealHarness(t, client, miner, miner)
|
||||
|
||||
// Starts a deal and waits until it's published
|
||||
runDealTillPublish := func(rseed int) {
|
||||
|
@ -54,6 +54,19 @@ func ConfigStorageMiner(c interface{}) Option {
|
||||
return Error(xerrors.Errorf("invalid config from repo, got: %T", c))
|
||||
}
|
||||
|
||||
pricingConfig := cfg.Dealmaking.RetrievalPricing
|
||||
if pricingConfig.Strategy == config.RetrievalPricingExternalMode {
|
||||
if pricingConfig.External == nil {
|
||||
return Error(xerrors.New("retrieval pricing policy has been to set to external but external policy config is nil"))
|
||||
}
|
||||
|
||||
if pricingConfig.External.Path == "" {
|
||||
return Error(xerrors.New("retrieval pricing policy has been to set to external but external script path is empty"))
|
||||
}
|
||||
} else if pricingConfig.Strategy != config.RetrievalPricingDefaultMode {
|
||||
return Error(xerrors.New("retrieval pricing policy must be either default or external"))
|
||||
}
|
||||
|
||||
enableLibp2pNode := cfg.Subsystems.EnableStorageMarket // we enable libp2p nodes if the storage market subsystem is enabled, otherwise we don't
|
||||
|
||||
return Options(
|
||||
@ -119,7 +132,7 @@ func ConfigStorageMiner(c interface{}) Option {
|
||||
Override(new(dtypes.StagingMultiDstore), modules.StagingMultiDatastore),
|
||||
Override(new(dtypes.StagingBlockstore), modules.StagingBlockstore),
|
||||
Override(new(dtypes.StagingDAG), modules.StagingDAG),
|
||||
Override(new(dtypes.StagingGraphsync), modules.StagingGraphsync),
|
||||
Override(new(dtypes.StagingGraphsync), modules.StagingGraphsync(cfg.Dealmaking.SimultaneousTransfers)),
|
||||
Override(new(dtypes.ProviderPieceStore), modules.NewProviderPieceStore),
|
||||
Override(new(*sectorblocks.SectorBlocks), sectorblocks.NewSectorBlocks),
|
||||
|
||||
@ -131,6 +144,7 @@ func ConfigStorageMiner(c interface{}) Option {
|
||||
Default: &config.RetrievalPricingDefault{},
|
||||
},
|
||||
})),
|
||||
Override(new(dtypes.RetrievalPricingFunc), modules.RetrievalPricingFunc(cfg.Dealmaking)),
|
||||
|
||||
// Markets (retrieval)
|
||||
Override(new(retrievalmarket.RetrievalProviderNode), retrievaladapter.NewRetrievalProviderNode),
|
||||
@ -165,6 +179,8 @@ func ConfigStorageMiner(c interface{}) Option {
|
||||
Override(new(dtypes.SetConsiderUnverifiedStorageDealsConfigFunc), modules.NewSetConsideringUnverifiedStorageDealsFunc),
|
||||
Override(new(dtypes.SetExpectedSealDurationFunc), modules.NewSetExpectedSealDurationFunc),
|
||||
Override(new(dtypes.GetExpectedSealDurationFunc), modules.NewGetExpectedSealDurationFunc),
|
||||
Override(new(dtypes.SetMaxDealStartDelayFunc), modules.NewSetMaxDealStartDelayFunc),
|
||||
Override(new(dtypes.GetMaxDealStartDelayFunc), modules.NewGetMaxDealStartDelayFunc),
|
||||
|
||||
If(cfg.Dealmaking.Filter != "",
|
||||
Override(new(dtypes.StorageDealFilter), modules.BasicDealFilter(dealfilter.CliStorageDealFilter(cfg.Dealmaking.Filter))),
|
||||
|
Loading…
Reference in New Issue
Block a user