mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-18 22:14:35 +00:00
info->notice, debug->info
This commit is contained in:
@@ -78,7 +78,7 @@ func (hvs *HeightVoteSet) addRound(round int) {
|
||||
if _, ok := hvs.roundVoteSets[round]; ok {
|
||||
panic("addRound() for an existing round")
|
||||
}
|
||||
log.Debug("addRound(round)", "round", round)
|
||||
log.Info("addRound(round)", "round", round)
|
||||
prevotes := NewVoteSet(hvs.height, round, types.VoteTypePrevote, hvs.valSet)
|
||||
precommits := NewVoteSet(hvs.height, round, types.VoteTypePrecommit, hvs.valSet)
|
||||
hvs.roundVoteSets[round] = RoundVoteSet{
|
||||
@@ -135,7 +135,7 @@ func (hvs *HeightVoteSet) POLRound() int {
|
||||
}
|
||||
|
||||
func (hvs *HeightVoteSet) getVoteSet(round int, type_ byte) *VoteSet {
|
||||
log.Debug("getVoteSet(round)", "round", round, "type", type_)
|
||||
log.Info("getVoteSet(round)", "round", round, "type", type_)
|
||||
rvs, ok := hvs.roundVoteSets[round]
|
||||
if !ok {
|
||||
return nil
|
||||
|
||||
+28
-28
@@ -56,7 +56,7 @@ func NewConsensusReactor(consensusState *ConsensusState, blockStore *bc.BlockSto
|
||||
// Implements Reactor
|
||||
func (conR *ConsensusReactor) Start(sw *p2p.Switch) {
|
||||
if atomic.CompareAndSwapUint32(&conR.running, 0, 1) {
|
||||
log.Info("Starting ConsensusReactor", "fastSync", conR.fastSync)
|
||||
log.Notice("Starting ConsensusReactor", "fastSync", conR.fastSync)
|
||||
conR.sw = sw
|
||||
if !conR.fastSync {
|
||||
conR.conS.Start()
|
||||
@@ -68,7 +68,7 @@ func (conR *ConsensusReactor) Start(sw *p2p.Switch) {
|
||||
// Implements Reactor
|
||||
func (conR *ConsensusReactor) Stop() {
|
||||
if atomic.CompareAndSwapUint32(&conR.running, 1, 0) {
|
||||
log.Info("Stopping ConsensusReactor")
|
||||
log.Notice("Stopping ConsensusReactor")
|
||||
conR.conS.Stop()
|
||||
close(conR.quit)
|
||||
}
|
||||
@@ -133,7 +133,7 @@ func (conR *ConsensusReactor) RemovePeer(peer *p2p.Peer, reason interface{}) {
|
||||
// Implements Reactor
|
||||
// NOTE: We process these messages even when we're fast_syncing.
|
||||
func (conR *ConsensusReactor) Receive(chId byte, peer *p2p.Peer, msgBytes []byte) {
|
||||
log.Debug("Receive", "channel", chId, "peer", peer, "bytes", msgBytes)
|
||||
log.Info("Receive", "channel", chId, "peer", peer, "bytes", msgBytes)
|
||||
if !conR.IsRunning() {
|
||||
return
|
||||
}
|
||||
@@ -146,7 +146,7 @@ func (conR *ConsensusReactor) Receive(chId byte, peer *p2p.Peer, msgBytes []byte
|
||||
log.Warn("Error decoding message", "channel", chId, "peer", peer, "msg", msg, "error", err, "bytes", msgBytes)
|
||||
return
|
||||
}
|
||||
log.Debug("Receive", "channel", chId, "peer", peer, "msg", msg, "rsHeight", rs.Height) //, "bytes", msgBytes)
|
||||
log.Info("Receive", "channel", chId, "peer", peer, "msg", msg, "rsHeight", rs.Height) //, "bytes", msgBytes)
|
||||
|
||||
switch chId {
|
||||
case StateChannel:
|
||||
@@ -275,7 +275,7 @@ func (conR *ConsensusReactor) SetPrivValidator(priv *sm.PrivValidator) {
|
||||
// Switch from the fast_sync to the consensus:
|
||||
// reset the state, turn off fast_sync, start the consensus-state-machine
|
||||
func (conR *ConsensusReactor) SwitchToConsensus(state *sm.State) {
|
||||
log.Info("SwitchToConsensus")
|
||||
log.Notice("SwitchToConsensus")
|
||||
// NOTE: The line below causes broadcastNewRoundStepRoutine() to
|
||||
// broadcast a NewRoundStepMessage.
|
||||
conR.conS.updateToState(state, false)
|
||||
@@ -349,7 +349,7 @@ OUTER_LOOP:
|
||||
for {
|
||||
// Manage disconnects from self or peer.
|
||||
if !peer.IsRunning() || !conR.IsRunning() {
|
||||
log.Info(Fmt("Stopping gossipDataRoutine for %v.", peer))
|
||||
log.Notice(Fmt("Stopping gossipDataRoutine for %v.", peer))
|
||||
return
|
||||
}
|
||||
rs := conR.conS.GetRoundState()
|
||||
@@ -357,7 +357,7 @@ OUTER_LOOP:
|
||||
|
||||
// Send proposal Block parts?
|
||||
if rs.ProposalBlockParts.HasHeader(prs.ProposalBlockPartsHeader) {
|
||||
//log.Debug("ProposalBlockParts matched", "blockParts", prs.ProposalBlockParts)
|
||||
//log.Info("ProposalBlockParts matched", "blockParts", prs.ProposalBlockParts)
|
||||
if index, ok := rs.ProposalBlockParts.BitArray().Sub(prs.ProposalBlockParts.Copy()).PickRandom(); ok {
|
||||
part := rs.ProposalBlockParts.GetPart(index)
|
||||
msg := &BlockPartMessage{
|
||||
@@ -373,12 +373,12 @@ OUTER_LOOP:
|
||||
|
||||
// If the peer is on a previous height, help catch up.
|
||||
if (0 < prs.Height) && (prs.Height < rs.Height) {
|
||||
//log.Debug("Data catchup", "height", rs.Height, "peerHeight", prs.Height, "peerProposalBlockParts", prs.ProposalBlockParts)
|
||||
//log.Info("Data catchup", "height", rs.Height, "peerHeight", prs.Height, "peerProposalBlockParts", prs.ProposalBlockParts)
|
||||
if index, ok := prs.ProposalBlockParts.Not().PickRandom(); ok {
|
||||
// Ensure that the peer's PartSetHeader is correct
|
||||
blockMeta := conR.blockStore.LoadBlockMeta(prs.Height)
|
||||
if !blockMeta.PartsHeader.Equals(prs.ProposalBlockPartsHeader) {
|
||||
log.Debug("Peer ProposalBlockPartsHeader mismatch, sleeping",
|
||||
log.Info("Peer ProposalBlockPartsHeader mismatch, sleeping",
|
||||
"peerHeight", prs.Height, "blockPartsHeader", blockMeta.PartsHeader, "peerBlockPartsHeader", prs.ProposalBlockPartsHeader)
|
||||
time.Sleep(peerGossipSleepDuration)
|
||||
continue OUTER_LOOP
|
||||
@@ -401,7 +401,7 @@ OUTER_LOOP:
|
||||
ps.SetHasProposalBlockPart(prs.Height, prs.Round, index)
|
||||
continue OUTER_LOOP
|
||||
} else {
|
||||
//log.Debug("No parts to send in catch-up, sleeping")
|
||||
//log.Info("No parts to send in catch-up, sleeping")
|
||||
time.Sleep(peerGossipSleepDuration)
|
||||
continue OUTER_LOOP
|
||||
}
|
||||
@@ -409,7 +409,7 @@ OUTER_LOOP:
|
||||
|
||||
// If height and round don't match, sleep.
|
||||
if (rs.Height != prs.Height) || (rs.Round != prs.Round) {
|
||||
//log.Debug("Peer Height|Round mismatch, sleeping", "peerHeight", prs.Height, "peerRound", prs.Round, "peer", peer)
|
||||
//log.Info("Peer Height|Round mismatch, sleeping", "peerHeight", prs.Height, "peerRound", prs.Round, "peer", peer)
|
||||
time.Sleep(peerGossipSleepDuration)
|
||||
continue OUTER_LOOP
|
||||
}
|
||||
@@ -458,7 +458,7 @@ OUTER_LOOP:
|
||||
for {
|
||||
// Manage disconnects from self or peer.
|
||||
if !peer.IsRunning() || !conR.IsRunning() {
|
||||
log.Info(Fmt("Stopping gossipVotesRoutine for %v.", peer))
|
||||
log.Notice(Fmt("Stopping gossipVotesRoutine for %v.", peer))
|
||||
return
|
||||
}
|
||||
rs := conR.conS.GetRoundState()
|
||||
@@ -471,7 +471,7 @@ OUTER_LOOP:
|
||||
sleeping = 0
|
||||
}
|
||||
|
||||
log.Debug("gossipVotesRoutine", "rsHeight", rs.Height, "rsRound", rs.Round,
|
||||
log.Info("gossipVotesRoutine", "rsHeight", rs.Height, "rsRound", rs.Round,
|
||||
"prsHeight", prs.Height, "prsRound", prs.Round, "prsStep", prs.Step)
|
||||
|
||||
// If height matches, then send LastCommit, Prevotes, Precommits.
|
||||
@@ -479,35 +479,35 @@ OUTER_LOOP:
|
||||
// If there are lastCommits to send...
|
||||
if prs.Step == RoundStepNewHeight {
|
||||
if ps.PickSendVote(rs.LastCommit) {
|
||||
log.Debug("Picked rs.LastCommit to send")
|
||||
log.Info("Picked rs.LastCommit to send")
|
||||
continue OUTER_LOOP
|
||||
}
|
||||
}
|
||||
// If there are prevotes to send...
|
||||
if rs.Round == prs.Round && prs.Step <= RoundStepPrevote {
|
||||
if ps.PickSendVote(rs.Votes.Prevotes(rs.Round)) {
|
||||
log.Debug("Picked rs.Prevotes(rs.Round) to send")
|
||||
log.Info("Picked rs.Prevotes(rs.Round) to send")
|
||||
continue OUTER_LOOP
|
||||
}
|
||||
}
|
||||
// If there are precommits to send...
|
||||
if rs.Round == prs.Round && prs.Step <= RoundStepPrecommit {
|
||||
if ps.PickSendVote(rs.Votes.Precommits(rs.Round)) {
|
||||
log.Debug("Picked rs.Precommits(rs.Round) to send")
|
||||
log.Info("Picked rs.Precommits(rs.Round) to send")
|
||||
continue OUTER_LOOP
|
||||
}
|
||||
}
|
||||
// If there are prevotes to send for the last round...
|
||||
if rs.Round == prs.Round+1 && prs.Step <= RoundStepPrevote {
|
||||
if ps.PickSendVote(rs.Votes.Prevotes(prs.Round)) {
|
||||
log.Debug("Picked rs.Prevotes(prs.Round) to send")
|
||||
log.Info("Picked rs.Prevotes(prs.Round) to send")
|
||||
continue OUTER_LOOP
|
||||
}
|
||||
}
|
||||
// If there are precommits to send for the last round...
|
||||
if rs.Round == prs.Round+1 && prs.Step <= RoundStepPrecommit {
|
||||
if ps.PickSendVote(rs.Votes.Precommits(prs.Round)) {
|
||||
log.Debug("Picked rs.Precommits(prs.Round) to send")
|
||||
log.Info("Picked rs.Precommits(prs.Round) to send")
|
||||
continue OUTER_LOOP
|
||||
}
|
||||
}
|
||||
@@ -515,7 +515,7 @@ OUTER_LOOP:
|
||||
if 0 <= prs.ProposalPOLRound {
|
||||
if polPrevotes := rs.Votes.Prevotes(prs.ProposalPOLRound); polPrevotes != nil {
|
||||
if ps.PickSendVote(polPrevotes) {
|
||||
log.Debug("Picked rs.Prevotes(prs.ProposalPOLRound) to send")
|
||||
log.Info("Picked rs.Prevotes(prs.ProposalPOLRound) to send")
|
||||
continue OUTER_LOOP
|
||||
}
|
||||
}
|
||||
@@ -526,7 +526,7 @@ OUTER_LOOP:
|
||||
// If peer is lagging by height 1, send LastCommit.
|
||||
if prs.Height != 0 && rs.Height == prs.Height+1 {
|
||||
if ps.PickSendVote(rs.LastCommit) {
|
||||
log.Debug("Picked rs.LastCommit to send")
|
||||
log.Info("Picked rs.LastCommit to send")
|
||||
continue OUTER_LOOP
|
||||
}
|
||||
}
|
||||
@@ -537,9 +537,9 @@ OUTER_LOOP:
|
||||
// Load the block validation for prs.Height,
|
||||
// which contains precommit signatures for prs.Height.
|
||||
validation := conR.blockStore.LoadBlockValidation(prs.Height)
|
||||
log.Debug("Loaded BlockValidation for catch-up", "height", prs.Height, "validation", validation)
|
||||
log.Info("Loaded BlockValidation for catch-up", "height", prs.Height, "validation", validation)
|
||||
if ps.PickSendVote(validation) {
|
||||
log.Debug("Picked Catchup validation to send")
|
||||
log.Info("Picked Catchup validation to send")
|
||||
continue OUTER_LOOP
|
||||
}
|
||||
}
|
||||
@@ -547,7 +547,7 @@ OUTER_LOOP:
|
||||
if sleeping == 0 {
|
||||
// We sent nothing. Sleep...
|
||||
sleeping = 1
|
||||
log.Debug("No votes to send, sleeping", "peer", peer,
|
||||
log.Info("No votes to send, sleeping", "peer", peer,
|
||||
"localPV", rs.Votes.Prevotes(rs.Round).BitArray(), "peerPV", prs.Prevotes,
|
||||
"localPC", rs.Votes.Precommits(rs.Round).BitArray(), "peerPC", prs.Precommits)
|
||||
} else if sleeping == 2 {
|
||||
@@ -783,23 +783,23 @@ func (ps *PeerState) setHasVote(height int, round int, type_ byte, index int) {
|
||||
switch type_ {
|
||||
case types.VoteTypePrevote:
|
||||
ps.Prevotes.SetIndex(index, true)
|
||||
log.Debug("SetHasVote(round-match)", "prevotes", ps.Prevotes, "index", index)
|
||||
log.Info("SetHasVote(round-match)", "prevotes", ps.Prevotes, "index", index)
|
||||
case types.VoteTypePrecommit:
|
||||
ps.Precommits.SetIndex(index, true)
|
||||
log.Debug("SetHasVote(round-match)", "precommits", ps.Precommits, "index", index)
|
||||
log.Info("SetHasVote(round-match)", "precommits", ps.Precommits, "index", index)
|
||||
}
|
||||
} else if ps.CatchupCommitRound == round {
|
||||
switch type_ {
|
||||
case types.VoteTypePrevote:
|
||||
case types.VoteTypePrecommit:
|
||||
ps.CatchupCommit.SetIndex(index, true)
|
||||
log.Debug("SetHasVote(CatchupCommit)", "precommits", ps.Precommits, "index", index)
|
||||
log.Info("SetHasVote(CatchupCommit)", "precommits", ps.Precommits, "index", index)
|
||||
}
|
||||
} else if ps.ProposalPOLRound == round {
|
||||
switch type_ {
|
||||
case types.VoteTypePrevote:
|
||||
ps.ProposalPOL.SetIndex(index, true)
|
||||
log.Debug("SetHasVote(ProposalPOL)", "prevotes", ps.Prevotes, "index", index)
|
||||
log.Info("SetHasVote(ProposalPOL)", "prevotes", ps.Prevotes, "index", index)
|
||||
case types.VoteTypePrecommit:
|
||||
}
|
||||
}
|
||||
@@ -809,7 +809,7 @@ func (ps *PeerState) setHasVote(height int, round int, type_ byte, index int) {
|
||||
case types.VoteTypePrevote:
|
||||
case types.VoteTypePrecommit:
|
||||
ps.LastCommit.SetIndex(index, true)
|
||||
log.Debug("setHasVote(LastCommit)", "lastCommit", ps.LastCommit, "index", index)
|
||||
log.Info("setHasVote(LastCommit)", "lastCommit", ps.LastCommit, "index", index)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
+40
-40
@@ -365,14 +365,14 @@ func (cs *ConsensusState) NewStepCh() chan *RoundState {
|
||||
|
||||
func (cs *ConsensusState) Start() {
|
||||
if atomic.CompareAndSwapUint32(&cs.started, 0, 1) {
|
||||
log.Info("Starting ConsensusState")
|
||||
log.Notice("Starting ConsensusState")
|
||||
cs.scheduleRound0(cs.Height)
|
||||
}
|
||||
}
|
||||
|
||||
// EnterNewRound(height, 0) at cs.StartTime.
|
||||
func (cs *ConsensusState) scheduleRound0(height int) {
|
||||
//log.Debug("scheduleRound0", "now", time.Now(), "startTime", cs.StartTime)
|
||||
//log.Info("scheduleRound0", "now", time.Now(), "startTime", cs.StartTime)
|
||||
sleepDuration := cs.StartTime.Sub(time.Now())
|
||||
go func() {
|
||||
if 0 < sleepDuration {
|
||||
@@ -384,7 +384,7 @@ func (cs *ConsensusState) scheduleRound0(height int) {
|
||||
|
||||
func (cs *ConsensusState) Stop() {
|
||||
if atomic.CompareAndSwapUint32(&cs.stopped, 0, 1) {
|
||||
log.Info("Stopping ConsensusState")
|
||||
log.Notice("Stopping ConsensusState")
|
||||
close(cs.quit)
|
||||
}
|
||||
}
|
||||
@@ -409,7 +409,7 @@ func (cs *ConsensusState) updateToState(state *sm.State, contiguous bool) {
|
||||
// This happens when SwitchToConsensus() is called in the reactor.
|
||||
// We don't want to reset e.g. the Votes.
|
||||
if cs.state != nil && (state.LastBlockHeight <= cs.state.LastBlockHeight) {
|
||||
log.Info("Ignoring updateToState()", "newHeight", state.LastBlockHeight+1, "oldHeight", cs.state.LastBlockHeight+1)
|
||||
log.Notice("Ignoring updateToState()", "newHeight", state.LastBlockHeight+1, "oldHeight", cs.state.LastBlockHeight+1)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ func (cs *ConsensusState) maybeRebond() {
|
||||
log.Error("Failed to broadcast RebondTx",
|
||||
"height", cs.Height, "round", cs.Round, "tx", rebondTx, "error", err)
|
||||
} else {
|
||||
log.Info("Signed and broadcast RebondTx",
|
||||
log.Notice("Signed and broadcast RebondTx",
|
||||
"height", cs.Height, "round", cs.Round, "tx", rebondTx)
|
||||
}
|
||||
} else {
|
||||
@@ -498,13 +498,13 @@ func (cs *ConsensusState) EnterNewRound(height int, round int) {
|
||||
cs.mtx.Lock()
|
||||
defer cs.mtx.Unlock()
|
||||
if cs.Height != height || round < cs.Round || (cs.Round == round && cs.Step != RoundStepNewHeight) {
|
||||
log.Debug(Fmt("EnterNewRound(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
log.Info(Fmt("EnterNewRound(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
return
|
||||
}
|
||||
if now := time.Now(); cs.StartTime.After(now) {
|
||||
log.Warn("Need to set a buffer and log.Warn() here for sanity.", "startTime", cs.StartTime, "now", now)
|
||||
}
|
||||
log.Info(Fmt("EnterNewRound(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
log.Notice(Fmt("EnterNewRound(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
|
||||
// Increment validators if necessary
|
||||
validators := cs.Validators
|
||||
@@ -537,10 +537,10 @@ func (cs *ConsensusState) EnterPropose(height int, round int) {
|
||||
cs.mtx.Lock()
|
||||
defer cs.mtx.Unlock()
|
||||
if cs.Height != height || round < cs.Round || (cs.Round == round && RoundStepPropose <= cs.Step) {
|
||||
log.Debug(Fmt("EnterPropose(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
log.Info(Fmt("EnterPropose(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
return
|
||||
}
|
||||
log.Debug(Fmt("EnterPropose(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
log.Info(Fmt("EnterPropose(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
|
||||
defer func() {
|
||||
// Done EnterPropose:
|
||||
@@ -566,9 +566,9 @@ func (cs *ConsensusState) EnterPropose(height int, round int) {
|
||||
}
|
||||
|
||||
if !bytes.Equal(cs.Validators.Proposer().Address, cs.privValidator.Address) {
|
||||
log.Debug("EnterPropose: Not our turn to propose", "proposer", cs.Validators.Proposer().Address, "privValidator", cs.privValidator)
|
||||
log.Info("EnterPropose: Not our turn to propose", "proposer", cs.Validators.Proposer().Address, "privValidator", cs.privValidator)
|
||||
} else {
|
||||
log.Debug("EnterPropose: Our turn to propose", "proposer", cs.Validators.Proposer().Address, "privValidator", cs.privValidator)
|
||||
log.Info("EnterPropose: Our turn to propose", "proposer", cs.Validators.Proposer().Address, "privValidator", cs.privValidator)
|
||||
cs.decideProposal(height, round)
|
||||
}
|
||||
}
|
||||
@@ -591,8 +591,8 @@ func (cs *ConsensusState) decideProposal(height int, round int) {
|
||||
proposal := NewProposal(height, round, blockParts.Header(), cs.Votes.POLRound())
|
||||
err := cs.privValidator.SignProposal(cs.state.ChainID, proposal)
|
||||
if err == nil {
|
||||
log.Info("Signed and set proposal", "height", height, "round", round, "proposal", proposal)
|
||||
log.Debug(Fmt("Signed and set proposal block: %v", block))
|
||||
log.Notice("Signed and set proposal", "height", height, "round", round, "proposal", proposal)
|
||||
log.Info(Fmt("Signed and set proposal block: %v", block))
|
||||
// Set fields
|
||||
cs.Proposal = proposal
|
||||
cs.ProposalBlock = block
|
||||
@@ -670,10 +670,10 @@ func (cs *ConsensusState) EnterPrevote(height int, round int) {
|
||||
cs.mtx.Lock()
|
||||
defer cs.mtx.Unlock()
|
||||
if cs.Height != height || round < cs.Round || (cs.Round == round && RoundStepPrevote <= cs.Step) {
|
||||
log.Debug(Fmt("EnterPrevote(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
log.Info(Fmt("EnterPrevote(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
return
|
||||
}
|
||||
log.Debug(Fmt("EnterPrevote(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
log.Info(Fmt("EnterPrevote(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
|
||||
// Sign and broadcast vote as necessary
|
||||
cs.doPrevote(height, round)
|
||||
@@ -691,7 +691,7 @@ func (cs *ConsensusState) EnterPrevote(height int, round int) {
|
||||
func (cs *ConsensusState) doPrevote(height int, round int) {
|
||||
// If a block is locked, prevote that.
|
||||
if cs.LockedBlock != nil {
|
||||
log.Debug("EnterPrevote: Block was locked")
|
||||
log.Info("EnterPrevote: Block was locked")
|
||||
cs.signAddVote(types.VoteTypePrevote, cs.LockedBlock.Hash(), cs.LockedBlockParts.Header())
|
||||
return
|
||||
}
|
||||
@@ -722,13 +722,13 @@ func (cs *ConsensusState) EnterPrevoteWait(height int, round int) {
|
||||
cs.mtx.Lock()
|
||||
defer cs.mtx.Unlock()
|
||||
if cs.Height != height || round < cs.Round || (cs.Round == round && RoundStepPrevoteWait <= cs.Step) {
|
||||
log.Debug(Fmt("EnterPrevoteWait(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
log.Info(Fmt("EnterPrevoteWait(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
return
|
||||
}
|
||||
if !cs.Votes.Prevotes(round).HasTwoThirdsAny() {
|
||||
panic(Fmt("EnterPrevoteWait(%v/%v), but Prevotes does not have any +2/3 votes", height, round))
|
||||
}
|
||||
log.Debug(Fmt("EnterPrevoteWait(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
log.Info(Fmt("EnterPrevoteWait(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
|
||||
// Done EnterPrevoteWait:
|
||||
cs.Round = round
|
||||
@@ -752,10 +752,10 @@ func (cs *ConsensusState) EnterPrecommit(height int, round int) {
|
||||
cs.mtx.Lock()
|
||||
defer cs.mtx.Unlock()
|
||||
if cs.Height != height || round < cs.Round || (cs.Round == round && RoundStepPrecommit <= cs.Step) {
|
||||
log.Debug(Fmt("EnterPrecommit(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
log.Info(Fmt("EnterPrecommit(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
return
|
||||
}
|
||||
log.Debug(Fmt("EnterPrecommit(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
log.Info(Fmt("EnterPrecommit(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
|
||||
defer func() {
|
||||
// Done EnterPrecommit:
|
||||
@@ -773,10 +773,10 @@ func (cs *ConsensusState) EnterPrecommit(height int, round int) {
|
||||
// If we don't have two thirds of prevotes, just precommit locked block or nil
|
||||
if !ok {
|
||||
if cs.LockedBlock != nil {
|
||||
log.Debug("EnterPrecommit: No +2/3 prevotes during EnterPrecommit. Precommitting lock.")
|
||||
log.Info("EnterPrecommit: No +2/3 prevotes during EnterPrecommit. Precommitting lock.")
|
||||
cs.signAddVote(types.VoteTypePrecommit, cs.LockedBlock.Hash(), cs.LockedBlockParts.Header())
|
||||
} else {
|
||||
log.Debug("EnterPrecommit: No +2/3 prevotes during EnterPrecommit. Precommitting nil.")
|
||||
log.Info("EnterPrecommit: No +2/3 prevotes during EnterPrecommit. Precommitting nil.")
|
||||
cs.signAddVote(types.VoteTypePrecommit, nil, types.PartSetHeader{})
|
||||
}
|
||||
return
|
||||
@@ -785,9 +785,9 @@ func (cs *ConsensusState) EnterPrecommit(height int, round int) {
|
||||
// +2/3 prevoted nil. Unlock and precommit nil.
|
||||
if len(hash) == 0 {
|
||||
if cs.LockedBlock == nil {
|
||||
log.Debug("EnterPrecommit: +2/3 prevoted for nil.")
|
||||
log.Info("EnterPrecommit: +2/3 prevoted for nil.")
|
||||
} else {
|
||||
log.Debug("EnterPrecommit: +2/3 prevoted for nil. Unlocking")
|
||||
log.Info("EnterPrecommit: +2/3 prevoted for nil. Unlocking")
|
||||
cs.LockedRound = 0
|
||||
cs.LockedBlock = nil
|
||||
cs.LockedBlockParts = nil
|
||||
@@ -800,14 +800,14 @@ func (cs *ConsensusState) EnterPrecommit(height int, round int) {
|
||||
|
||||
// If +2/3 prevoted for already locked block, precommit it.
|
||||
if cs.LockedBlock.HashesTo(hash) {
|
||||
log.Debug("EnterPrecommit: +2/3 prevoted locked block.")
|
||||
log.Info("EnterPrecommit: +2/3 prevoted locked block.")
|
||||
cs.signAddVote(types.VoteTypePrecommit, hash, partsHeader)
|
||||
return
|
||||
}
|
||||
|
||||
// If +2/3 prevoted for proposal block, stage and precommit it
|
||||
if cs.ProposalBlock.HashesTo(hash) {
|
||||
log.Debug("EnterPrecommit: +2/3 prevoted proposal block.")
|
||||
log.Info("EnterPrecommit: +2/3 prevoted proposal block.")
|
||||
// Validate the block.
|
||||
if err := cs.stageBlock(cs.ProposalBlock, cs.ProposalBlockParts); err != nil {
|
||||
panic(Fmt("EnterPrecommit: +2/3 prevoted for an invalid block: %v", err))
|
||||
@@ -841,13 +841,13 @@ func (cs *ConsensusState) EnterPrecommitWait(height int, round int) {
|
||||
cs.mtx.Lock()
|
||||
defer cs.mtx.Unlock()
|
||||
if cs.Height != height || round < cs.Round || (cs.Round == round && RoundStepPrecommitWait <= cs.Step) {
|
||||
log.Debug(Fmt("EnterPrecommitWait(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
log.Info(Fmt("EnterPrecommitWait(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
return
|
||||
}
|
||||
if !cs.Votes.Precommits(round).HasTwoThirdsAny() {
|
||||
panic(Fmt("EnterPrecommitWait(%v/%v), but Precommits does not have any +2/3 votes", height, round))
|
||||
}
|
||||
log.Debug(Fmt("EnterPrecommitWait(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
log.Info(Fmt("EnterPrecommitWait(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))
|
||||
|
||||
// Done EnterPrecommitWait:
|
||||
cs.Round = round
|
||||
@@ -870,10 +870,10 @@ func (cs *ConsensusState) EnterCommit(height int) {
|
||||
cs.mtx.Lock()
|
||||
defer cs.mtx.Unlock()
|
||||
if cs.Height != height || RoundStepCommit <= cs.Step {
|
||||
log.Debug(Fmt("EnterCommit(%v): Invalid args. Current step: %v/%v/%v", height, cs.Height, cs.Round, cs.Step))
|
||||
log.Info(Fmt("EnterCommit(%v): Invalid args. Current step: %v/%v/%v", height, cs.Height, cs.Round, cs.Step))
|
||||
return
|
||||
}
|
||||
log.Debug(Fmt("EnterCommit(%v). Current: %v/%v/%v", height, cs.Height, cs.Round, cs.Step))
|
||||
log.Info(Fmt("EnterCommit(%v). Current: %v/%v/%v", height, cs.Height, cs.Round, cs.Step))
|
||||
|
||||
defer func() {
|
||||
// Done Entercommit:
|
||||
@@ -944,7 +944,7 @@ func (cs *ConsensusState) FinalizeCommit(height int) {
|
||||
defer cs.mtx.Unlock()
|
||||
|
||||
if cs.Height != height || cs.Step != RoundStepCommit {
|
||||
log.Debug(Fmt("FinalizeCommit(%v): Invalid args. Current step: %v/%v/%v", height, cs.Height, cs.Round, cs.Step))
|
||||
log.Info(Fmt("FinalizeCommit(%v): Invalid args. Current step: %v/%v/%v", height, cs.Height, cs.Round, cs.Step))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -965,7 +965,7 @@ func (cs *ConsensusState) FinalizeCommit(height int) {
|
||||
}
|
||||
// END SANITY CHECK
|
||||
|
||||
log.Debug(Fmt("Finalizing commit of block: %v", cs.ProposalBlock))
|
||||
log.Info(Fmt("Finalizing commit of block: %v", cs.ProposalBlock))
|
||||
// We have the block, so stage/save/commit-vote.
|
||||
cs.saveBlock(cs.ProposalBlock, cs.ProposalBlockParts, cs.Votes.Precommits(cs.Round))
|
||||
// Increment height.
|
||||
@@ -1044,7 +1044,7 @@ func (cs *ConsensusState) AddProposalBlockPart(height int, part *types.Part) (ad
|
||||
var n int64
|
||||
var err error
|
||||
cs.ProposalBlock = binary.ReadBinary(&types.Block{}, cs.ProposalBlockParts.GetReader(), &n, &err).(*types.Block)
|
||||
log.Debug("Received complete proposal", "hash", cs.ProposalBlock.Hash())
|
||||
log.Info("Received complete proposal", "hash", cs.ProposalBlock.Hash())
|
||||
if cs.Step == RoundStepPropose && cs.isProposalComplete() {
|
||||
// Move onto the next step
|
||||
go cs.EnterPrevote(height, cs.Round)
|
||||
@@ -1067,13 +1067,13 @@ func (cs *ConsensusState) AddVote(address []byte, vote *types.Vote, peerKey stri
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
func (cs *ConsensusState) addVote(address []byte, vote *types.Vote, peerKey string) (added bool, index int, err error) {
|
||||
log.Debug("addVote", "voteHeight", vote.Height, "voteType", vote.Type, "csHeight", cs.Height)
|
||||
log.Info("addVote", "voteHeight", vote.Height, "voteType", vote.Type, "csHeight", cs.Height)
|
||||
|
||||
// A precommit for the previous height?
|
||||
if vote.Height+1 == cs.Height && vote.Type == types.VoteTypePrecommit {
|
||||
added, index, err = cs.LastCommit.AddByAddress(address, vote)
|
||||
if added {
|
||||
log.Debug(Fmt("Added to lastPrecommits: %v", cs.LastCommit.StringShort()))
|
||||
log.Info(Fmt("Added to lastPrecommits: %v", cs.LastCommit.StringShort()))
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -1086,7 +1086,7 @@ func (cs *ConsensusState) addVote(address []byte, vote *types.Vote, peerKey stri
|
||||
switch vote.Type {
|
||||
case types.VoteTypePrevote:
|
||||
prevotes := cs.Votes.Prevotes(vote.Round)
|
||||
log.Debug(Fmt("Added to prevotes: %v", prevotes.StringShort()))
|
||||
log.Info(Fmt("Added to prevotes: %v", prevotes.StringShort()))
|
||||
// First, unlock if prevotes is a valid POL.
|
||||
// >> lockRound < POLRound <= unlockOrChangeLockRound (see spec)
|
||||
// NOTE: If (lockRound < POLRound) but !(POLRound <= unlockOrChangeLockRound),
|
||||
@@ -1095,7 +1095,7 @@ func (cs *ConsensusState) addVote(address []byte, vote *types.Vote, peerKey stri
|
||||
if (cs.LockedBlock != nil) && (cs.LockedRound < vote.Round) && (vote.Round <= cs.Round) {
|
||||
hash, _, ok := prevotes.TwoThirdsMajority()
|
||||
if ok && !cs.LockedBlock.HashesTo(hash) {
|
||||
log.Info("Unlocking because of POL.", "lockedRound", cs.LockedRound, "POLRound", vote.Round)
|
||||
log.Notice("Unlocking because of POL.", "lockedRound", cs.LockedRound, "POLRound", vote.Round)
|
||||
cs.LockedRound = 0
|
||||
cs.LockedBlock = nil
|
||||
cs.LockedBlockParts = nil
|
||||
@@ -1122,7 +1122,7 @@ func (cs *ConsensusState) addVote(address []byte, vote *types.Vote, peerKey stri
|
||||
}
|
||||
case types.VoteTypePrecommit:
|
||||
precommits := cs.Votes.Precommits(vote.Round)
|
||||
log.Debug(Fmt("Added to precommit: %v", precommits.StringShort()))
|
||||
log.Info(Fmt("Added to precommit: %v", precommits.StringShort()))
|
||||
if cs.Round <= vote.Round && precommits.HasTwoThirdsAny() {
|
||||
go func() {
|
||||
hash, _, ok := precommits.TwoThirdsMajority()
|
||||
@@ -1149,7 +1149,7 @@ func (cs *ConsensusState) addVote(address []byte, vote *types.Vote, peerKey stri
|
||||
}
|
||||
|
||||
// Height mismatch, bad peer?
|
||||
log.Debug("Vote ignored and not added", "voteHeight", vote.Height, "csHeight", cs.Height)
|
||||
log.Info("Vote ignored and not added", "voteHeight", vote.Height, "csHeight", cs.Height)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1196,7 +1196,7 @@ func (cs *ConsensusState) signAddVote(type_ byte, hash []byte, header types.Part
|
||||
err := cs.privValidator.SignVote(cs.state.ChainID, vote)
|
||||
if err == nil {
|
||||
_, _, err := cs.addVote(cs.privValidator.Address, vote, "")
|
||||
log.Info("Signed and added vote", "height", cs.Height, "round", cs.Round, "vote", vote, "error", err)
|
||||
log.Notice("Signed and added vote", "height", cs.Height, "round", cs.Round, "vote", vote, "error", err)
|
||||
return vote
|
||||
} else {
|
||||
log.Warn("Error signing vote", "height", cs.Height, "round", cs.Round, "vote", vote, "error", err)
|
||||
|
||||
Reference in New Issue
Block a user