From 8bf77d9b1af4efa297e483dc999f08150b1e09d4 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Wed, 6 Jan 2021 10:07:10 -0500 Subject: [PATCH] statesync: do not recover panic on peer updates (#5869) --- statesync/reactor.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/statesync/reactor.go b/statesync/reactor.go index 071d4e534..23ce26608 100644 --- a/statesync/reactor.go +++ b/statesync/reactor.go @@ -392,14 +392,7 @@ func (r *Reactor) processChunkCh() { // processPeerUpdate processes a PeerUpdate, returning an error upon failing to // handle the PeerUpdate or if a panic is recovered. -func (r *Reactor) processPeerUpdate(peerUpdate p2p.PeerUpdate) (err error) { - defer func() { - if e := recover(); e != nil { - err = fmt.Errorf("panic in processing peer update: %v", e) - r.Logger.Error("recovering from processing peer update panic", "err", err) - } - }() - +func (r *Reactor) processPeerUpdate(peerUpdate p2p.PeerUpdate) { r.Logger.Debug("received peer update", "peer", peerUpdate.PeerID, "status", peerUpdate.Status) r.mtx.RLock() @@ -414,8 +407,6 @@ func (r *Reactor) processPeerUpdate(peerUpdate p2p.PeerUpdate) (err error) { r.syncer.RemovePeer(peerUpdate.PeerID) } } - - return err } // processPeerUpdates initiates a blocking process where we listen for and handle @@ -427,7 +418,7 @@ func (r *Reactor) processPeerUpdates() { for { select { case peerUpdate := <-r.peerUpdates.Updates(): - _ = r.processPeerUpdate(peerUpdate) + r.processPeerUpdate(peerUpdate) case <-r.closeCh: r.Logger.Debug("stopped listening on peer updates channel; closing...")