Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export methods for in-place-testnet command #255

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions export/export.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package export

import (
"github.com/tendermint/tendermint/internal/state"
"github.com/tendermint/tendermint/internal/store"
)

var NewBlockStore = store.NewBlockStore
var NewStore = state.NewStore
6 changes: 3 additions & 3 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func makeNode(
return nil, combineCloseError(fmt.Errorf("error in genesis doc: %w", err), makeCloser(closers))
}

state, err := loadStateFromDBOrGenesisDocProvider(stateStore, genDoc)
state, err := LoadStateFromDBOrGenesisDocProvider(stateStore, genDoc)
if err != nil {
return nil, combineCloseError(err, makeCloser(closers))
}
Expand Down Expand Up @@ -778,10 +778,10 @@ func DefaultMetricsProvider(cfg *config.InstrumentationConfig) metricsProvider {

//------------------------------------------------------------------------------

// loadStateFromDBOrGenesisDocProvider attempts to load the state from the
// LoadStateFromDBOrGenesisDocProvider attempts to load the state from the
// database, or creates one using the given genesisDocProvider. On success this also
// returns the genesis doc loaded through the given provider.
func loadStateFromDBOrGenesisDocProvider(stateStore sm.Store, genDoc *types.GenesisDoc) (sm.State, error) {
func LoadStateFromDBOrGenesisDocProvider(stateStore sm.Store, genDoc *types.GenesisDoc) (sm.State, error) {

// 1. Attempt to load state form the database
state, err := stateStore.Load()
Expand Down
2 changes: 1 addition & 1 deletion node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ func loadStatefromGenesis(ctx context.Context, t *testing.T) sm.State {
valSet, _ := factory.ValidatorSet(ctx, t, 0, 10)
genDoc := factory.GenesisDoc(cfg, time.Now(), valSet.Validators, factory.ConsensusParams())

state, err := loadStateFromDBOrGenesisDocProvider(
state, err := LoadStateFromDBOrGenesisDocProvider(
stateStore,
genDoc,
)
Expand Down
Loading