From 2db49a706432f808e5c80682f78ad223371bc3f9 Mon Sep 17 00:00:00 2001 From: Zhong Qiu <36867992+zhongqiuwood@users.noreply.github.com> Date: Sun, 21 Nov 2021 22:53:32 +0800 Subject: [PATCH] Merge PR: display bp addr (#1212) --- Makefile | 2 +- libs/tendermint/consensus/state.go | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 52faee9b46..3c96521444 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/libs/tendermint/consensus/state.go b/libs/tendermint/consensus/state.go index 546bdbd074..04175c8621 100644 --- a/libs/tendermint/consensus/state.go +++ b/libs/tendermint/consensus/state.go @@ -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) @@ -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))