consensus: some more informative logging

This commit is contained in:
Ethan Buchman 2017-03-05 02:04:09 -05:00
parent d93d754972
commit de0153a1c4
4 changed files with 7 additions and 5 deletions

View File

@ -211,6 +211,8 @@ func (h *Handshaker) Handshake(proxyApp proxy.AppConns) error {
return errors.New(Fmt("Error on replay: %v", err))
}
log.Notice("Completed ABCI Handshake - Tendermint and App are synced", "appHeight", blockHeight, "appHash", appHash)
// TODO: (on restart) replay mempool
return nil

View File

@ -1160,13 +1160,13 @@ func (cs *ConsensusState) tryFinalizeCommit(height int) {
blockID, ok := cs.Votes.Precommits(cs.CommitRound).TwoThirdsMajority()
if !ok || len(blockID.Hash) == 0 {
log.Warn("Attempt to finalize failed. There was no +2/3 majority, or +2/3 was for <nil>.")
log.Warn("Attempt to finalize failed. There was no +2/3 majority, or +2/3 was for <nil>.", "height", height)
return
}
if !cs.ProposalBlock.HashesTo(blockID.Hash) {
// TODO: this happens every time if we're not a validator (ugly logs)
// TODO: ^^ wait, why does it matter that we're a validator?
log.Warn("Attempt to finalize failed. We don't have the commit block.")
log.Warn("Attempt to finalize failed. We don't have the commit block.", "height", height, "proposal-block", cs.ProposalBlock.Hash(), "commit-block", blockID.Hash)
return
}
// go

View File

@ -96,7 +96,7 @@ func (b *Block) FillHeader() {
// If the block is incomplete, block hash is nil for safety.
func (b *Block) Hash() []byte {
// fmt.Println(">>", b.Data)
if b.Header == nil || b.Data == nil || b.LastCommit == nil {
if b == nil || b.Header == nil || b.Data == nil || b.LastCommit == nil {
return nil
}
b.FillHeader()

View File

@ -6,7 +6,7 @@ import (
"sort"
"strings"
. "github.com/tendermint/go-common"
cmn "github.com/tendermint/go-common"
"github.com/tendermint/go-merkle"
)
@ -48,7 +48,7 @@ func NewValidatorSet(vals []*Validator) *ValidatorSet {
// TODO: mind the overflow when times and votingPower shares too large.
func (valSet *ValidatorSet) IncrementAccum(times int) {
// Add VotingPower * times to each validator and order into heap.
validatorsHeap := NewHeap()
validatorsHeap := cmn.NewHeap()
for _, val := range valSet.Validators {
val.Accum += int64(val.VotingPower) * int64(times) // TODO: mind overflow
validatorsHeap.Push(val, accumComparable(val.Accum))