move cli bundle loading back to init
This commit is contained in:
parent
98730b90a3
commit
37d94a3c91
19
cli/init.go
Normal file
19
cli/init.go
Normal file
@ -0,0 +1,19 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/filecoin-project/lotus/blockstore"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// preload manifest so that we have the correct code CID inventory for cli since that doesn't
|
||||
// go through CI
|
||||
bs := blockstore.NewMemory()
|
||||
|
||||
if err := actors.FetchAndLoadBundles(context.Background(), bs, build.BuiltinActorReleases); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
@ -21,9 +21,6 @@ import (
|
||||
"github.com/filecoin-project/lotus/api/client"
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
"github.com/filecoin-project/lotus/api/v1api"
|
||||
"github.com/filecoin-project/lotus/blockstore"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
)
|
||||
|
||||
@ -31,14 +28,6 @@ const (
|
||||
metadataTraceContext = "traceContext"
|
||||
)
|
||||
|
||||
func loadBundles(ctx context.Context) error {
|
||||
// preload manifest so that we have the correct code CID inventory for cli since that doesn't
|
||||
// go through CI
|
||||
bs := blockstore.NewMemory()
|
||||
|
||||
return actors.FetchAndLoadBundles(ctx, bs, build.BuiltinActorReleases)
|
||||
}
|
||||
|
||||
// GetAPIInfo returns the API endpoint to use for the specified kind of repo.
|
||||
//
|
||||
// The order of precedence is as follows:
|
||||
@ -48,11 +37,6 @@ func loadBundles(ctx context.Context) error {
|
||||
// 3. deprecated *_API_INFO environment variables
|
||||
// 4. *-repo command line flags.
|
||||
func GetAPIInfo(ctx *cli.Context, t repo.RepoType) (APIInfo, error) {
|
||||
// do this first
|
||||
if err := loadBundles(ctx.Context); err != nil {
|
||||
return APIInfo{}, fmt.Errorf("error loading builtin-actor bundles: %w", err)
|
||||
}
|
||||
|
||||
// Check if there was a flag passed with the listen address of the API
|
||||
// server (only used by the tests)
|
||||
for _, f := range t.APIFlags() {
|
||||
|
Loading…
Reference in New Issue
Block a user