Skip to content

Commit

Permalink
Export methods for in-place-testnet command (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
codchen authored Jan 24, 2025
1 parent 184afc7 commit b352e3f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
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

0 comments on commit b352e3f

Please sign in to comment.