mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-14 22:01:20 +00:00
rebase fixes
This commit is contained in:
@ -41,9 +41,8 @@ func initTMRoot(rootDir string) {
|
|||||||
if !FileExists(genesisFilePath) {
|
if !FileExists(genesisFilePath) {
|
||||||
MustWriteFile(genesisFilePath, []byte(defaultGenesis), 0644)
|
MustWriteFile(genesisFilePath, []byte(defaultGenesis), 0644)
|
||||||
}
|
}
|
||||||
if !FileExists(privFilePath) {
|
// we always overwrite the priv val
|
||||||
MustWriteFile(privFilePath, []byte(defaultPrivValidator), 0644)
|
MustWriteFile(privFilePath, []byte(defaultPrivValidator), 0644)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetConfig(rootDir string) cfg.Config {
|
func GetConfig(rootDir string) cfg.Config {
|
||||||
|
@ -239,7 +239,7 @@ func (conR *ConsensusReactor) registerEventCallbacks() {
|
|||||||
conR.broadcastNewRoundStep(rs)
|
conR.broadcastNewRoundStep(rs)
|
||||||
})
|
})
|
||||||
|
|
||||||
conR.evsw.AddListenerForEvent("conR", types.EventStringVote(), func(data types.EventData) {
|
conR.evsw.AddListenerForEvent("conR", types.EventStringVote(), func(data events.EventData) {
|
||||||
edv := data.(types.EventDataVote)
|
edv := data.(types.EventDataVote)
|
||||||
conR.broadcastHasVoteMessage(edv.Vote, edv.Index)
|
conR.broadcastHasVoteMessage(edv.Vote, edv.Index)
|
||||||
})
|
})
|
||||||
|
@ -2,7 +2,6 @@ package consensus
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
@ -85,7 +84,7 @@ func (cs *ConsensusState) catchupReplay(height int) error {
|
|||||||
}
|
}
|
||||||
m, ok := msg.Msg.(*types.EventDataRoundState)
|
m, ok := msg.Msg.(*types.EventDataRoundState)
|
||||||
if ok && m.Step == RoundStepNewHeight.String() {
|
if ok && m.Step == RoundStepNewHeight.String() {
|
||||||
r, err := f.Seek(0, 1)
|
f.Seek(0, 1)
|
||||||
// TODO: ensure the height matches
|
// TODO: ensure the height matches
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -203,7 +202,7 @@ func (pb *playback) replayReset(count int) error {
|
|||||||
|
|
||||||
pb.cs.Stop()
|
pb.cs.Stop()
|
||||||
|
|
||||||
newCs := NewConsensusState(pb.genesisState.Copy(), pb.cs.proxyAppCtx, pb.cs.blockStore, pb.cs.mempool)
|
newCs := NewConsensusState(pb.genesisState.Copy(), pb.cs.proxyAppConn, pb.cs.blockStore, pb.cs.mempool)
|
||||||
newCs.SetEventSwitch(pb.cs.evsw)
|
newCs.SetEventSwitch(pb.cs.evsw)
|
||||||
|
|
||||||
// ensure all new step events are regenerated as expected
|
// ensure all new step events are regenerated as expected
|
||||||
|
@ -1430,41 +1430,6 @@ func (cs *ConsensusState) signAddVote(type_ byte, hash []byte, header types.Part
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save Block, save the +2/3 Commits we've seen
|
|
||||||
func (cs *ConsensusState) saveBlock(block *types.Block, blockParts *types.PartSet, commits *types.VoteSet) {
|
|
||||||
|
|
||||||
// The proposal must be valid.
|
|
||||||
if err := cs.stageBlock(block, blockParts); err != nil {
|
|
||||||
PanicSanity(Fmt("saveBlock() an invalid block: %v", err))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save to blockStore.
|
|
||||||
if cs.blockStore.Height() < block.Height {
|
|
||||||
seenValidation := commits.MakeValidation()
|
|
||||||
cs.blockStore.SaveBlock(block, blockParts, seenValidation)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Commit to proxyAppCtx
|
|
||||||
err := cs.stagedState.Commit(cs.proxyAppCtx)
|
|
||||||
if err != nil {
|
|
||||||
// TODO: handle this gracefully.
|
|
||||||
PanicQ(Fmt("Commit failed for applicaiton"))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save the state.
|
|
||||||
cs.stagedState.Save()
|
|
||||||
|
|
||||||
// Update mempool.
|
|
||||||
cs.mempool.Update(block)
|
|
||||||
|
|
||||||
// Fire off event
|
|
||||||
if cs.evsw != nil && cs.evc != nil {
|
|
||||||
cs.evsw.FireEvent(types.EventStringNewBlock(), types.EventDataNewBlock{block})
|
|
||||||
go cs.evc.Flush()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
|
|
||||||
func CompareHRS(h1, r1 int, s1 RoundStepType, h2, r2 int, s2 RoundStepType) int {
|
func CompareHRS(h1, r1 int, s1 RoundStepType, h2, r2 int, s2 RoundStepType) int {
|
||||||
|
10
node/node.go
10
node/node.go
@ -323,11 +323,11 @@ func newConsensusState() *consensus.ConsensusState {
|
|||||||
stateDB := dbm.GetDB("state")
|
stateDB := dbm.GetDB("state")
|
||||||
state := sm.MakeGenesisStateFromFile(stateDB, config.GetString("genesis_file"))
|
state := sm.MakeGenesisStateFromFile(stateDB, config.GetString("genesis_file"))
|
||||||
|
|
||||||
// Create two proxyAppCtx connections,
|
// Create two proxyAppConn connections,
|
||||||
// one for the consensus and one for the mempool.
|
// one for the consensus and one for the mempool.
|
||||||
proxyAddr := config.GetString("proxy_app")
|
proxyAddr := config.GetString("proxy_app")
|
||||||
proxyAppCtxMempool := getProxyApp(proxyAddr, state.LastAppHash)
|
proxyAppConnMempool := getProxyApp(proxyAddr, state.AppHash)
|
||||||
proxyAppCtxConsensus := getProxyApp(proxyAddr, state.LastAppHash)
|
proxyAppConnConsensus := getProxyApp(proxyAddr, state.AppHash)
|
||||||
|
|
||||||
// add the chainid to the global config
|
// add the chainid to the global config
|
||||||
config.Set("chain_id", state.ChainID)
|
config.Set("chain_id", state.ChainID)
|
||||||
@ -339,9 +339,9 @@ func newConsensusState() *consensus.ConsensusState {
|
|||||||
Exit(Fmt("Failed to start event switch: %v", err))
|
Exit(Fmt("Failed to start event switch: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
mempool := mempl.NewMempool(proxyAppCtxMempool)
|
mempool := mempl.NewMempool(proxyAppConnMempool)
|
||||||
|
|
||||||
consensusState := consensus.NewConsensusState(state.Copy(), proxyAppCtxConsensus, blockStore, mempool)
|
consensusState := consensus.NewConsensusState(state.Copy(), proxyAppConnConsensus, blockStore, mempool)
|
||||||
consensusState.SetEventSwitch(eventSwitch)
|
consensusState.SetEventSwitch(eventSwitch)
|
||||||
return consensusState
|
return consensusState
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user