8
8
"sync"
9
9
"time"
10
10
11
+ "github.com/tendermint/tendermint/config"
11
12
cstypes "github.com/tendermint/tendermint/internal/consensus/types"
12
13
"github.com/tendermint/tendermint/internal/eventbus"
13
14
"github.com/tendermint/tendermint/internal/p2p"
@@ -121,6 +122,7 @@ type ConsSyncReactor interface {
121
122
type Reactor struct {
122
123
service.BaseService
123
124
logger log.Logger
125
+ cfg * config.Config
124
126
125
127
state * State
126
128
eventBus * eventbus.EventBus
@@ -148,6 +150,7 @@ func NewReactor(
148
150
eventBus * eventbus.EventBus ,
149
151
waitSync bool ,
150
152
metrics * Metrics ,
153
+ cfg * config.Config ,
151
154
) * Reactor {
152
155
r := & Reactor {
153
156
logger : logger ,
@@ -160,6 +163,7 @@ func NewReactor(
160
163
peerEvents : peerEvents ,
161
164
readySignal : make (chan struct {}),
162
165
channels : & channelBundle {},
166
+ cfg : cfg ,
163
167
}
164
168
r .BaseService = * service .NewBaseService (logger , "Consensus" , r )
165
169
@@ -646,7 +650,12 @@ func (r *Reactor) pickSendVote(ctx context.Context, ps *PeerState, votes types.V
646
650
return false , nil
647
651
}
648
652
649
- r .logger .Debug ("sending vote message" , "ps" , ps , "vote" , vote )
653
+ if r .cfg .BaseConfig .LogLevel == log .LogLevelDebug {
654
+ psJson , err := ps .ToJSON () // expensive, so we only want to call if debug is on
655
+ if err != nil {
656
+ r .logger .Debug ("sending vote message" , "ps" , string (psJson ), "vote" , vote )
657
+ }
658
+ }
650
659
if err := voteCh .Send (ctx , p2p.Envelope {
651
660
To : ps .peerID ,
652
661
Message : & tmcons.Vote {
0 commit comments