From c8a357c6734cfea6a45f8da0810379d85ff3f38c Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Wed, 20 Oct 2021 06:42:53 +0700 Subject: [PATCH] fix nil pointer on error --- txpool/send.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/txpool/send.go b/txpool/send.go index 1eac08d69..eb5e04c5a 100644 --- a/txpool/send.go +++ b/txpool/send.go @@ -101,9 +101,9 @@ func (f *Send) BroadcastLocalPooledTxs(txs Hashes) (sentToPeers int) { peers, err := sentryClient.SendMessageToAll(f.ctx, req65, &grpc.EmptyCallOption{}) if err != nil { log.Warn("[txpool.send] BroadcastLocalPooledTxs", "err", err) + } else { + avgPeersPerSent65 += len(peers.Peers) } - avgPeersPerSent65 += len(peers.Peers) - case direct.ETH66: if req66 == nil { req66 = &sentry.OutboundMessageData{ @@ -114,8 +114,9 @@ func (f *Send) BroadcastLocalPooledTxs(txs Hashes) (sentToPeers int) { peers, err := sentryClient.SendMessageToAll(f.ctx, req66, &grpc.EmptyCallOption{}) if err != nil { log.Warn("[txpool.send] BroadcastLocalPooledTxs", "err", err) + } else { + avgPeersPerSent66 += len(peers.Peers) } - avgPeersPerSent66 += len(peers.Peers) } } }