Skip to content

Commit 645a7b0

Browse files
authored
chore: use the legacy prop mechanism to propose the block even if the recovery fails (#2639)
1 parent ccb67cb commit 645a7b0

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

consensus/state.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff 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.
270280
func 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

node/setup.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)