Skip to content

Commit

Permalink
Merge PR: display bp addr (#1212)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongqiuwood authored Nov 21, 2021
1 parent 48b6119 commit 2db49a7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export GO111MODULE=on
GithubTop=github.com


Version=v0.19.14
Version=v0.19.16
CosmosSDK=v0.39.2
Tendermint=v0.33.9
Iavl=v0.14.3
Expand Down
13 changes: 10 additions & 3 deletions libs/tendermint/consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -910,17 +910,23 @@ func (cs *State) needProofBlock(height int64) bool {
return !bytes.Equal(cs.state.AppHash, lastBlockMeta.Header.AppHash)
}

func (cs *State) isBlockProducer() string {
func (cs *State) isBlockProducer() (string, string) {
bpAddr := ""
isBlockProducer := "n"
if cs.privValidator != nil && cs.privValidatorPubKey != nil {
address := cs.privValidatorPubKey.Address()

if cs.isProposer != nil && cs.isProposer(address) {
isBlockProducer = "y"
bpAddr = cs.Validators.GetProposer().Address.String()
const len2display int = 6
if len(bpAddr) > len2display {
bpAddr = bpAddr[:len2display]
}
}
}

return isBlockProducer
return isBlockProducer, bpAddr
}

// Enter (CreateEmptyBlocks): from enterNewRound(height,round)
Expand All @@ -941,7 +947,8 @@ func (cs *State) enterPropose(height int64, round int) {
return
}

cs.trc.Pin("Propose-%d-%s", round, cs.isBlockProducer())
isBlockProducer, bpAddr := cs.isBlockProducer()
cs.trc.Pin("Propose-%d-%s-%s", round, isBlockProducer, bpAddr)

logger.Info(fmt.Sprintf("enterPropose(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))

Expand Down

0 comments on commit 2db49a7

Please sign in to comment.