Browse Source

consensus: some more informative logging

pull/426/head
Ethan Buchman 8 years ago
parent
commit
de0153a1c4
4 changed files with 7 additions and 5 deletions
  1. +2
    -0
      consensus/replay.go
  2. +2
    -2
      consensus/state.go
  3. +1
    -1
      types/block.go
  4. +2
    -2
      types/validator_set.go

+ 2
- 0
consensus/replay.go 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


+ 2
- 2
consensus/state.go 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


+ 1
- 1
types/block.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()


+ 2
- 2
types/validator_set.go 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))


Loading…
Cancel
Save