@@ -200,7 +200,7 @@ func (x *XDPoS_v2) initial(chain consensus.ChainReader, header *types.Header) er
200200 var quorumCert * types.QuorumCert
201201 var err error
202202
203- if header .Number .Int64 () == x .config .V2 .SwitchBlock . Int64 () {
203+ if header .Number .Cmp ( x .config .V2 .SwitchBlock ) == 0 {
204204 log .Info ("[initial] highest QC for consensus v2 first block" )
205205 blockInfo := & types.BlockInfo {
206206 Hash : header .Hash (),
@@ -273,7 +273,11 @@ func (x *XDPoS_v2) initial(chain consensus.ChainReader, header *types.Header) er
273273 }()
274274
275275 // Kick-off the countdown timer
276- x .timeoutWorker .Reset (chain , 0 , 0 )
276+ // Only kick-off if it is V2 switch block
277+ // Otherwise it is a lagging node, already kick-off in `processQC`
278+ if header .Number .Cmp (x .config .V2 .SwitchBlock ) == 0 {
279+ x .timeoutWorker .Reset (chain , 0 , 0 )
280+ }
277281 x .isInitilised = true
278282
279283 log .Warn ("[initial] finish initialisation" )
@@ -989,7 +993,7 @@ func (x *XDPoS_v2) calcMasternodes(chain consensus.ChainReader, blockNum *big.In
989993 }
990994 candidates := snap .NextEpochCandidates
991995
992- if blockNum .Uint64 () == x .config .V2 .SwitchBlock . Uint64 () + 1 {
996+ if blockNum .Cmp ( new (big. Int ). Add ( x .config .V2 .SwitchBlock , big . NewInt ( 1 ))) == 0 {
993997 log .Info ("[calcMasternodes] examing first v2 block" )
994998 if len (candidates ) > maxMasternodes {
995999 candidates = candidates [:maxMasternodes ]
0 commit comments