Replayable
This commit is contained in:
parent
9c236ffd6c
commit
754572cf83
|
@ -47,6 +47,7 @@ func (cs *ConsensusState) readReplayMessage(msg *TimedWALMessage, newStepCh chan
|
|||
return nil
|
||||
}
|
||||
|
||||
cs.Logger.Debug("Next message time: " + msg.Time.String())
|
||||
// for logging
|
||||
switch m := msg.Msg.(type) {
|
||||
case types.EventDataRoundState:
|
||||
|
@ -58,6 +59,7 @@ func (cs *ConsensusState) readReplayMessage(msg *TimedWALMessage, newStepCh chan
|
|||
case mi := <-newStepCh:
|
||||
m2 := mi.(types.EventDataRoundState)
|
||||
if m.Height != m2.Height || m.Round != m2.Round || m.Step != m2.Step {
|
||||
//TODO comment next line to continue -> H38
|
||||
return fmt.Errorf("RoundState mismatch. Got %v; Expected %v", m2, m)
|
||||
}
|
||||
case <-ticker:
|
||||
|
|
|
@ -4,13 +4,12 @@ import (
|
|||
"bufio"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/pkg/errors"
|
||||
"io"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
bc "github.com/tendermint/tendermint/blockchain"
|
||||
cfg "github.com/tendermint/tendermint/config"
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
|
@ -45,7 +44,7 @@ func (cs *ConsensusState) ReplayFile(file string, console bool) error {
|
|||
return errors.New("cs is already running, cannot replay")
|
||||
}
|
||||
if cs.wal != nil {
|
||||
return errors.New("cs wal is open, cannot replay")
|
||||
//return errors.New("cs wal is open, cannot replay")
|
||||
}
|
||||
|
||||
cs.startForReplay()
|
||||
|
@ -78,8 +77,20 @@ func (cs *ConsensusState) ReplayFile(file string, console bool) error {
|
|||
}
|
||||
|
||||
pb := newPlayback(file, fp, cs, cs.state.Copy())
|
||||
pb.cs.Logger = log.NewTMLogger(os.Stdout)
|
||||
defer pb.fp.Close() // nolint: errcheck
|
||||
|
||||
go func() {
|
||||
for {
|
||||
<-cs.timeoutTicker.Chan()
|
||||
}
|
||||
}()
|
||||
go func() {
|
||||
for {
|
||||
<-cs.statsMsgQueue
|
||||
}
|
||||
}()
|
||||
|
||||
var nextN int // apply N msgs in a row
|
||||
var msg *TimedWALMessage
|
||||
for {
|
||||
|
@ -340,7 +351,7 @@ func newConsensusStateForReplay(config cfg.BaseConfig, csConfig *cfg.ConsensusCo
|
|||
mempool, evpool := sm.MockMempool{}, sm.MockEvidencePool{}
|
||||
blockExec := sm.NewBlockExecutor(stateDB, log.TestingLogger(), proxyApp.Consensus(), mempool, evpool)
|
||||
|
||||
consensusState := NewConsensusState(csConfig, state.Copy(), blockExec,
|
||||
consensusState := NewConsensusState(csConfig, sm.LoadState(stateDB).Copy(), blockExec,
|
||||
blockStore, mempool, evpool)
|
||||
|
||||
consensusState.SetEventBus(eventBus)
|
||||
|
|
|
@ -71,7 +71,7 @@ func (t *timeoutTicker) Chan() <-chan timeoutInfo {
|
|||
// The timeoutRoutine is always available to read from tickChan, so this won't block.
|
||||
// The scheduling may fail if the timeoutRoutine has already scheduled a timeout for a later height/round/step.
|
||||
func (t *timeoutTicker) ScheduleTimeout(ti timeoutInfo) {
|
||||
t.tickChan <- ti
|
||||
//t.tickChan <- ti
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue