From 68f37fff65102ef9d5ff51df2cd0f43489fc20c1 Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Wed, 19 Feb 2020 12:28:34 +0100 Subject: [PATCH] Use uint64 for consensus.Reactor.SwitchToConsensus() blocksSynced (#4433) --- blockchain/v0/reactor.go | 4 ++-- blockchain/v1/reactor.go | 4 ++-- blockchain/v1/reactor_test.go | 2 +- consensus/reactor.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/blockchain/v0/reactor.go b/blockchain/v0/reactor.go index c35a3e6a9..d47e892c2 100644 --- a/blockchain/v0/reactor.go +++ b/blockchain/v0/reactor.go @@ -41,7 +41,7 @@ const ( type consensusReactor interface { // for when we switch from blockchain reactor and fast sync to // the consensus machine - SwitchToConsensus(sm.State, int) + SwitchToConsensus(sm.State, uint64) } type peerError struct { @@ -214,7 +214,7 @@ func (bcR *BlockchainReactor) poolRoutine() { statusUpdateTicker := time.NewTicker(statusUpdateIntervalSeconds * time.Second) switchToConsensusTicker := time.NewTicker(switchToConsensusIntervalSeconds * time.Second) - blocksSynced := 0 + blocksSynced := uint64(0) chainID := bcR.initialState.ChainID state := bcR.initialState diff --git a/blockchain/v1/reactor.go b/blockchain/v1/reactor.go index c1932d406..b57901789 100644 --- a/blockchain/v1/reactor.go +++ b/blockchain/v1/reactor.go @@ -43,7 +43,7 @@ var ( type consensusReactor interface { // for when we switch from blockchain reactor and fast sync to // the consensus machine - SwitchToConsensus(sm.State, int) + SwitchToConsensus(sm.State, uint64) } // BlockchainReactor handles long-term catchup syncing. @@ -59,7 +59,7 @@ type BlockchainReactor struct { fastSync bool fsm *BcReactorFSM - blocksSynced int + blocksSynced uint64 // Receive goroutine forwards messages to this channel to be processed in the context of the poolRoutine. messagesForFSMCh chan bcReactorMessage diff --git a/blockchain/v1/reactor_test.go b/blockchain/v1/reactor_test.go index 2add11df1..deb73ad6d 100644 --- a/blockchain/v1/reactor_test.go +++ b/blockchain/v1/reactor_test.go @@ -157,7 +157,7 @@ type consensusReactorTest struct { mtx sync.Mutex } -func (conR *consensusReactorTest) SwitchToConsensus(state sm.State, blocksSynced int) { +func (conR *consensusReactorTest) SwitchToConsensus(state sm.State, blocksSynced uint64) { conR.mtx.Lock() defer conR.mtx.Unlock() conR.switchedToConsensus = true diff --git a/consensus/reactor.go b/consensus/reactor.go index 40868ff9d..0f2dad743 100644 --- a/consensus/reactor.go +++ b/consensus/reactor.go @@ -98,7 +98,7 @@ func (conR *Reactor) OnStop() { // SwitchToConsensus switches from fast_sync mode to consensus mode. // It resets the state, turns off fast_sync, and starts the consensus state-machine -func (conR *Reactor) SwitchToConsensus(state sm.State, blocksSynced int) { +func (conR *Reactor) SwitchToConsensus(state sm.State, blocksSynced uint64) { conR.Logger.Info("SwitchToConsensus") conR.conS.reconstructLastCommit(state) // NOTE: The line below causes broadcastNewRoundStepRoutine() to