From b78a746f7adbc55fda727f5f8876589a5311f820 Mon Sep 17 00:00:00 2001 From: Tsahi Zidenberg Date: Thu, 6 Jun 2024 17:30:49 -0600 Subject: [PATCH] handler_p2p: address comments --- arbitrum/handler_p2p.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arbitrum/handler_p2p.go b/arbitrum/handler_p2p.go index 44e12b8dd4..9a6146b35e 100644 --- a/arbitrum/handler_p2p.go +++ b/arbitrum/handler_p2p.go @@ -157,7 +157,7 @@ func (h *protocolHandler) peerDrop(id string) { defer hPeer.mutex.Unlock() hPeer.arb = nil if hPeer.eth != nil { - hPeer.eth.Disconnect(p2p.DiscSelf) + hPeer.eth.Disconnect(p2p.DiscUselessPeer) err := h.downloader.UnregisterPeer(id) if err != nil { log.Warn("failed deregistering peer from downloader", "err", err) @@ -329,12 +329,10 @@ func (h *arbHandler) HandleCheckpoint(peer *arb.Peer, checkpoint *types.Header, skeleton := rawdb.ReadSkeletonHeader(h.db, number) if skeleton == nil { log.Error("arbitrum handler_p2p: canonical not found", "number", number, "peer", peer.ID()) + return } canonical = skeleton.Hash() } - if canonical == (common.Hash{}) { - log.Error("arbitrum handler_p2p: did not find a canonical hash", "number", number, "peer", peer.ID()) - } if canonical != checkpoint.Hash() { log.Warn("got bad header from peer - bad hash", "peer", peer.ID(), "number", number, "expected", canonical, "peer", checkpoint.Hash()) protoHandler.peerDrop(peer.ID()) @@ -526,7 +524,7 @@ func (h *snapHandler) StorageIterator(root, account, origin common.Hash) (snapsh } nodeIter, err := storageTrie.NodeIterator(origin[:]) if err != nil { - log.Error("Failed node iterator to open storage trie", "root", acc.Root, "err", err) + log.Error("Failed creating node iterator to open storage trie", "root", acc.Root, "err", err) return nil, err } return trieStoreageIterator{trieIteratorWrapper{