provide an option to disable loading of built-in assets.
This commit is contained in:
parent
596ed330dd
commit
d20255b1b4
@ -13,6 +13,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func BuiltinBootstrap() ([]peer.AddrInfo, error) {
|
func BuiltinBootstrap() ([]peer.AddrInfo, error) {
|
||||||
|
if DisableBuiltinAssets {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
var out []peer.AddrInfo
|
var out []peer.AddrInfo
|
||||||
|
|
||||||
b := rice.MustFindBox("bootstrap")
|
b := rice.MustFindBox("bootstrap")
|
||||||
|
15
build/flags.go
Normal file
15
build/flags.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package build
|
||||||
|
|
||||||
|
// DisableBuiltinAssets disables the resolution of go.rice boxes that store
|
||||||
|
// built-in assets, such as proof parameters, bootstrap peers, genesis blocks,
|
||||||
|
// etc.
|
||||||
|
//
|
||||||
|
// When this value is set to true, it is expected that the user will
|
||||||
|
// provide any such configurations through the Lotus API itself.
|
||||||
|
//
|
||||||
|
// This is useful when you're using Lotus as a library, such as to orchestrate
|
||||||
|
// test scenarios, or for other purposes where you don't need to use the
|
||||||
|
// defaults shipped with the binary.
|
||||||
|
//
|
||||||
|
// For this flag to be effective, it must be enabled _before_ instantiating Lotus.
|
||||||
|
var DisableBuiltinAssets = false
|
@ -75,6 +75,12 @@ func GetParams(sbc *ffiwrapper.Config) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If built-in assets are disabled, we expect the user to have placed the right
|
||||||
|
// parameters in the right location on the filesystem (/var/tmp/filecoin-proof-parameters).
|
||||||
|
if build.DisableBuiltinAssets {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if err := paramfetch.GetParams(context.TODO(), build.ParametersJSON(), uint64(ssize)); err != nil {
|
if err := paramfetch.GetParams(context.TODO(), build.ParametersJSON(), uint64(ssize)); err != nil {
|
||||||
return xerrors.Errorf("fetching proof parameters: %w", err)
|
return xerrors.Errorf("fetching proof parameters: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user