mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-28 20:06:24 +00:00
fast sync fixes
This commit is contained in:
+4
-1
@@ -132,6 +132,7 @@ func (pool *BlockPool) IsCaughtUp() bool {
|
||||
|
||||
// Need at least 1 peer to be considered caught up.
|
||||
if len(pool.peers) == 0 {
|
||||
log.Debug("Blockpool has no peers")
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -142,7 +143,9 @@ func (pool *BlockPool) IsCaughtUp() bool {
|
||||
}
|
||||
pool.peersMtx.Unlock()
|
||||
|
||||
return (height > 0 || time.Now().Sub(pool.startTime) > 5*time.Second) && (maxPeerHeight == 0 || height == maxPeerHeight)
|
||||
isCaughtUp := (height > 0 || time.Now().Sub(pool.startTime) > 5*time.Second) && (maxPeerHeight == 0 || height >= maxPeerHeight)
|
||||
log.Notice(Fmt("IsCaughtUp: %v", isCaughtUp), "height", height, "maxPeerHeight", maxPeerHeight)
|
||||
return isCaughtUp
|
||||
}
|
||||
|
||||
// We need to see the second block's Validation to validate the first block.
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"time"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/go-events"
|
||||
"github.com/tendermint/go-p2p"
|
||||
"github.com/tendermint/go-wire"
|
||||
"github.com/tendermint/go-events"
|
||||
"github.com/tendermint/tendermint/proxy"
|
||||
sm "github.com/tendermint/tendermint/state"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
|
||||
@@ -49,6 +49,8 @@ Commands:
|
||||
gen_validator()
|
||||
case "probe_upnp":
|
||||
probe_upnp()
|
||||
case "unsafe_reset_all":
|
||||
reset_all()
|
||||
case "unsafe_reset_priv_validator":
|
||||
reset_priv_validator()
|
||||
case "version":
|
||||
|
||||
@@ -6,6 +6,14 @@ import (
|
||||
"github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
// NOTE: this is totally unsafe.
|
||||
// it's only suitable for testnets.
|
||||
func reset_all() {
|
||||
reset_priv_validator()
|
||||
os.RemoveAll(config.GetString("db_dir"))
|
||||
os.Remove(config.GetString("cswal"))
|
||||
}
|
||||
|
||||
// NOTE: this is totally unsafe.
|
||||
// it's only suitable for testnets.
|
||||
func reset_priv_validator() {
|
||||
|
||||
@@ -73,6 +73,7 @@ func (conR *ConsensusReactor) OnStop() {
|
||||
// reset the state, turn off fast_sync, start the consensus-state-machine
|
||||
func (conR *ConsensusReactor) SwitchToConsensus(state *sm.State) {
|
||||
log.Notice("SwitchToConsensus")
|
||||
conR.conS.reconstructLastCommit(state)
|
||||
// NOTE: The line below causes broadcastNewRoundStepRoutine() to
|
||||
// broadcast a NewRoundStepMessage.
|
||||
conR.conS.updateToState(state)
|
||||
|
||||
+6
-2
@@ -618,7 +618,7 @@ func (cs *ConsensusState) handleMsg(mi msgInfo, rs RoundState) {
|
||||
log.Warn("Unknown msg type", reflect.TypeOf(msg))
|
||||
}
|
||||
if err != nil {
|
||||
log.Error("error with msg", "error", err)
|
||||
log.Error("Error with msg", "type", reflect.TypeOf(msg), "error", err, "msg", msg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1281,7 +1281,11 @@ func (cs *ConsensusState) tryAddVote(valIndex int, vote *types.Vote, peerKey str
|
||||
if err == ErrVoteHeightMismatch {
|
||||
return err
|
||||
} else if _, ok := err.(*types.ErrVoteConflictingSignature); ok {
|
||||
log.Warn("Found conflicting vote. Publish evidence")
|
||||
if peerKey == "" {
|
||||
log.Warn("Found conflicting vote from ourselves. Did you unsafe_reset a validator?", "height", vote.Height, "round", vote.Round, "type", vote.Type)
|
||||
return err
|
||||
}
|
||||
log.Warn("Found conflicting vote. Publish evidence (TODO)")
|
||||
/* TODO
|
||||
evidenceTx := &types.DupeoutTx{
|
||||
Address: address,
|
||||
|
||||
Reference in New Issue
Block a user