MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / stateAndStore

Function stateAndStore

consensus/replay_test.go:1161–1177  ·  view source on GitHub ↗

fresh state and mock store

(
	config *cfg.Config,
	pubKey crypto.PubKey,
	appVersion uint64,
)

Source from the content-addressed store, hash-verified

1159
1160// fresh state and mock store
1161func stateAndStore(
1162 config *cfg.Config,
1163 pubKey crypto.PubKey,
1164 appVersion uint64,
1165) (dbm.DB, sm.State, *mockBlockStore) {
1166 stateDB := dbm.NewMemDB()
1167 stateStore := sm.NewStore(stateDB, sm.StoreOptions{
1168 DiscardABCIResponses: false,
1169 })
1170 state, _ := sm.MakeGenesisStateFromFile(config.GenesisFile())
1171 state.Version.Consensus.App = appVersion
1172 store := newMockBlockStore(config, state.ConsensusParams)
1173 if err := stateStore.Save(state); err != nil {
1174 panic(err)
1175 }
1176 return stateDB, state, store
1177}
1178
1179//----------------------------------
1180// mock block store

Calls 3

SaveMethod · 0.95
newMockBlockStoreFunction · 0.85
GenesisFileMethod · 0.80

Tested by

no test coverage detected