diff --git a/node/node.go b/node/node.go index 6fe6426e252..4f865f1794e 100644 --- a/node/node.go +++ b/node/node.go @@ -141,7 +141,16 @@ func StateProvider(stateProvider statesync.StateProvider) Option { // store are empty at the time the function is called. // // If the block store is not empty, the function returns an error. -func BootstrapState(ctx context.Context, config *cfg.Config, dbProvider cfg.DBProvider, height uint64, appHash []byte) (err error) { +func BootstrapState(ctx context.Context, config *cfg.Config, dbProvider cfg.DBProvider, height uint64, appHash []byte) error { + return BootstrapStateWithGenProvider(ctx, config, dbProvider, DefaultGenesisDocProviderFunc(config), height, appHash) +} + +// BootstrapStateWithGenProvider synchronizes the stores with the application after state sync +// has been performed offline. It is expected that the block store and state +// store are empty at the time the function is called. +// +// If the block store is not empty, the function returns an error. +func BootstrapStateWithGenProvider(ctx context.Context, config *cfg.Config, dbProvider cfg.DBProvider, genProvider GenesisDocProvider, height uint64, appHash []byte) (err error) { logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)) if ctx == nil { ctx = context.Background() @@ -193,7 +202,7 @@ func BootstrapState(ctx context.Context, config *cfg.Config, dbProvider cfg.DBPr return fmt.Errorf("state not empty, trying to initialize non empty state") } - genState, _, err := LoadStateFromDBOrGenesisDocProvider(stateDB, DefaultGenesisDocProviderFunc(config)) + genState, _, err := LoadStateFromDBOrGenesisDocProvider(stateDB, genProvider) if err != nil { return err }