File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,9 @@ type State struct {
169169
170170 // traceClient is used to trace the state machine.
171171 traceClient trace.Tracer
172+
173+ // gossipDataEnabled controls whether the gossipDataRoutine should run
174+ gossipDataEnabled atomic.Bool
172175}
173176
174177// StateOption sets an optional parameter on the State.
@@ -265,6 +268,13 @@ func SetTraceClient(ec trace.Tracer) StateOption {
265268 return func (cs * State ) { cs .traceClient = ec }
266269}
267270
271+ // SetGossipDataEnabled specifies whether the legacy block prop is enabled.
272+ func SetGossipDataEnabled (enabled bool ) StateOption {
273+ return func (cs * State ) {
274+ cs .gossipDataEnabled .Store (enabled )
275+ }
276+ }
277+
268278// OfflineStateSyncHeight indicates the height at which the node
269279// statesync offline - before booting sets the metrics.
270280func OfflineStateSyncHeight (height int64 ) StateOption {
@@ -1391,7 +1401,9 @@ func (cs *State) defaultDecideProposal(height int64, round int32) {
13911401 err = cs .propagator .ProposeBlock (proposal , blockParts , metaData )
13921402 if err != nil {
13931403 cs .Logger .Error ("propagation reactor failed to propose the block" , "err" , err )
1394- return
1404+ if ! cs .gossipDataEnabled .Load () {
1405+ return
1406+ }
13951407 }
13961408
13971409 // send proposal and block parts on internal msg queue
Original file line number Diff line number Diff line change @@ -388,6 +388,7 @@ func createConsensusReactor(config *cfg.Config,
388388 cs .StateMetrics (csMetrics ),
389389 cs .OfflineStateSyncHeight (offlineStateSyncHeight ),
390390 cs .SetTraceClient (traceClient ),
391+ cs .SetGossipDataEnabled (config .Consensus .EnableLegacyBlockProp ),
391392 )
392393 consensusState .SetLogger (consensusLogger )
393394 if privValidator != nil {
You can’t perform that action at this time.
0 commit comments