consensus: replay console

This commit is contained in:
Ethan Buchman
2015-12-23 01:27:40 -05:00
parent 6aaa5fb0bf
commit 2b13386d7b
4 changed files with 317 additions and 96 deletions

View File

@ -311,12 +311,7 @@ func RunNode() {
})
}
func RunReplay() {
msgLogFile := config.GetString("cs_msg_log")
if msgLogFile == "" {
Exit("cs_msg_log file name not set in tendermint config")
}
func newConsensusState() *consensus.ConsensusState {
// Get BlockStore
blockStoreDB := dbm.GetDB("blockstore")
blockStore := bc.NewBlockStore(blockStoreDB)
@ -345,8 +340,31 @@ func RunReplay() {
consensusState := consensus.NewConsensusState(state.Copy(), proxyAppCtxConsensus, blockStore, mempool)
consensusState.SetEventSwitch(eventSwitch)
return consensusState
}
if err := consensusState.ReplayMessagesFromFile(msgLogFile); err != nil {
func RunReplayConsole() {
msgLogFile := config.GetString("cs_msg_log")
if msgLogFile == "" {
Exit("cs_msg_log file name not set in tendermint config")
}
consensusState := newConsensusState()
if err := consensusState.ReplayConsole(msgLogFile); err != nil {
Exit(Fmt("Error during consensus replay: %v", err))
}
}
func RunReplay() {
msgLogFile := config.GetString("cs_msg_log")
if msgLogFile == "" {
Exit("cs_msg_log file name not set in tendermint config")
}
consensusState := newConsensusState()
if err := consensusState.ReplayMessages(msgLogFile); err != nil {
Exit(Fmt("Error during consensus replay: %v", err))
}
log.Notice("Replay run successfully")