From 7c559a983496f05c36f0138896a339f7d301fe71 Mon Sep 17 00:00:00 2001 From: laizy Date: Fri, 19 Jul 2024 15:11:56 +0800 Subject: [PATCH] rename --- consensus/vbft/event_timer.go | 11 ++++------- consensus/vbft/service.go | 10 +++++----- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/consensus/vbft/event_timer.go b/consensus/vbft/event_timer.go index abb476ebd..9a02d07de 100644 --- a/consensus/vbft/event_timer.go +++ b/consensus/vbft/event_timer.go @@ -302,7 +302,7 @@ func (self *EventTimer) CancelTxBlockTimeout(blockNum uint32) { self.cancelEventTimer(EventTxBlockTimeout, blockNum) } -func (self *EventTimer) startPeerTicker(peerIdx uint32) error { +func (self *EventTimer) startPeerTicker(peerIdx uint32) { self.lock.Lock() defer self.lock.Unlock() @@ -319,11 +319,9 @@ func (self *EventTimer) startPeerTicker(peerIdx uint32) error { } self.peerTickers[peerIdx].Reset(timeout) }) - - return nil } -func (self *EventTimer) stopPeerTicker(peerIdx uint32) error { +func (self *EventTimer) stopPeerTicker(peerIdx uint32) { self.lock.Lock() defer self.lock.Unlock() @@ -331,17 +329,16 @@ func (self *EventTimer) stopPeerTicker(peerIdx uint32) error { p.Stop() delete(self.peerTickers, peerIdx) } - return nil } -func (self *EventTimer) startTxTicker(blockNum uint32) { +func (self *EventTimer) startTxPoolTicker(blockNum uint32) { self.lock.Lock() defer self.lock.Unlock() self.startEventTimer(EventTxPool, blockNum) } -func (self *EventTimer) stopTxTicker(blockNum uint32) { +func (self *EventTimer) stopTxPoolTicker(blockNum uint32) { self.lock.Lock() defer self.lock.Unlock() diff --git a/consensus/vbft/service.go b/consensus/vbft/service.go index e27dd5ca0..81ff6d21f 100644 --- a/consensus/vbft/service.go +++ b/consensus/vbft/service.go @@ -724,7 +724,7 @@ func (self *Server) startNewRound() error { self.processProposalMsg(proposal) return nil } - self.timer.startTxTicker(blkNum) + self.timer.startTxPoolTicker(blkNum) self.timer.StartTxBlockTimeout(blkNum) return nil } @@ -1835,7 +1835,7 @@ func (self *Server) processTimerEvent(evt *TimerEvent) error { self.heartbeat() case EventTxPool: - self.timer.stopTxTicker(evt.blockNum) + self.timer.stopTxPoolTicker(evt.blockNum) if self.GetCompletedBlockNum()+1 == evt.blockNum { validHeight := self.validHeight(evt.blockNum) newProposal := false @@ -1851,13 +1851,13 @@ func (self *Server) processTimerEvent(evt *TimerEvent) error { self.startNewProposal(evt.blockNum) } else { //reset timer, continue waiting txs from txnpool - self.timer.startTxTicker(evt.blockNum) + self.timer.startTxPoolTicker(evt.blockNum) } } else { - self.timer.startTxTicker(evt.blockNum) + self.timer.startTxPoolTicker(evt.blockNum) } case EventTxBlockTimeout: - self.timer.stopTxTicker(evt.blockNum) + self.timer.stopTxPoolTicker(evt.blockNum) self.timer.CancelTxBlockTimeout(evt.blockNum) self.startNewProposal(evt.blockNum) }