diff --git a/cmd/sentry/sentry/sentry_grpc_server.go b/cmd/sentry/sentry/sentry_grpc_server.go index fdac089ce..d6c72aabb 100644 --- a/cmd/sentry/sentry/sentry_grpc_server.go +++ b/cmd/sentry/sentry/sentry_grpc_server.go @@ -813,7 +813,7 @@ func (ss *GrpcServer) SendMessageByMinBlock(_ context.Context, inreq *proto_sent msgcode != eth.GetPooledTransactionsMsg { return reply, fmt.Errorf("sendMessageByMinBlock not implemented for message Id: %s", inreq.Data.Id) } - if !ss.GetStatus().PassivePeers { + if inreq.MaxPeers == 1 { peerInfo, found := ss.findPeerByMinBlock(inreq.MinBlock) if found { ss.writePeer("sendMessageByMinBlock", peerInfo, msgcode, inreq.Data.Data, 30*time.Second) diff --git a/cmd/sentry/sentry/sentry_multi_client.go b/cmd/sentry/sentry/sentry_multi_client.go index d170f7dc5..ec8a966e1 100644 --- a/cmd/sentry/sentry/sentry_multi_client.go +++ b/cmd/sentry/sentry/sentry_multi_client.go @@ -393,15 +393,13 @@ func (cs *MultiClient) blockHeaders66(ctx context.Context, in *proto_sentry.Inbo func (cs *MultiClient) blockHeaders(ctx context.Context, pkt eth.BlockHeadersPacket, rlpStream *rlp.Stream, peerID *proto_types.H512, sentry direct.SentryClient) error { if len(pkt) == 0 { - if cs.Hd.InitialCycle() { - outreq := proto_sentry.PeerUselessRequest{ - PeerId: peerID, - } - if _, err := sentry.PeerUseless(ctx, &outreq, &grpc.EmptyCallOption{}); err != nil { - return fmt.Errorf("sending peer useless request: %v", err) - } - log.Debug("Requested removal of peer for empty header response", "peerId", fmt.Sprintf("%x", ConvertH512ToPeerID(peerID))[:8]) + outreq := proto_sentry.PeerUselessRequest{ + PeerId: peerID, } + if _, err := sentry.PeerUseless(ctx, &outreq, &grpc.EmptyCallOption{}); err != nil { + return fmt.Errorf("sending peer useless request: %v", err) + } + log.Debug("Requested removal of peer for empty header response", "peerId", fmt.Sprintf("%x", ConvertH512ToPeerID(peerID))[:8]) // No point processing empty response return nil } @@ -558,16 +556,14 @@ func (cs *MultiClient) blockBodies66(ctx context.Context, inreq *proto_sentry.In return fmt.Errorf("decode BlockBodiesPacket66: %w", err) } txs, uncles, withdrawals := request.BlockRawBodiesPacket.Unpack() - if len(txs) == 0 && len(uncles) == 0 { - if cs.Hd.InitialCycle() { - outreq := proto_sentry.PeerUselessRequest{ - PeerId: inreq.PeerId, - } - if _, err := sentry.PeerUseless(ctx, &outreq, &grpc.EmptyCallOption{}); err != nil { - return fmt.Errorf("sending peer useless request: %v", err) - } - log.Debug("Requested removal of peer for empty body response", "peerId", fmt.Sprintf("%x", ConvertH512ToPeerID(inreq.PeerId))) + if len(txs) == 0 && len(uncles) == 0 && len(withdrawals) == 0 { + outreq := proto_sentry.PeerUselessRequest{ + PeerId: inreq.PeerId, } + if _, err := sentry.PeerUseless(ctx, &outreq, &grpc.EmptyCallOption{}); err != nil { + return fmt.Errorf("sending peer useless request: %v", err) + } + log.Debug("Requested removal of peer for empty body response", "peerId", fmt.Sprintf("%x", ConvertH512ToPeerID(inreq.PeerId))) // No point processing empty response return nil } diff --git a/eth/stagedsync/stage_headers.go b/eth/stagedsync/stage_headers.go index 208026939..b842d6f25 100644 --- a/eth/stagedsync/stage_headers.go +++ b/eth/stagedsync/stage_headers.go @@ -861,10 +861,6 @@ Loop: if headerInserter.BestHeaderChanged() { // We do not break unless there best header changed noProgressCounter = 0 wasProgress = true - if !initialCycle { - // if this is not an initial cycle, we need to react quickly when new headers are coming in - break - } // if this is initial cycle, we want to make sure we insert all known headers (inSync) if inSync { break