From 7bb3fb1481acbffd91afe19f802c29b1ae6ea60c Mon Sep 17 00:00:00 2001 From: cui <523516579@qq.com> Date: Wed, 3 Apr 2024 14:08:52 +0800 Subject: [PATCH] eth: simplify peer counting logic (#29420) --- eth/handler.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/eth/handler.go b/eth/handler.go index 0d27e061c4..c7c582af40 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -466,9 +466,7 @@ func (h *handler) BroadcastTransactions(txs types.Transactions) { largeTxs int // Number of large transactions to announce only directCount int // Number of transactions sent directly to peers (duplicates included) - directPeers int // Number of peers that were sent transactions directly annCount int // Number of transactions announced across all peers (duplicates included) - annPeers int // Number of peers announced about transactions txset = make(map[*ethPeer][]common.Hash) // Set peer->hash to transfer directly annos = make(map[*ethPeer][]common.Hash) // Set peer->hash to announce @@ -525,17 +523,15 @@ func (h *handler) BroadcastTransactions(txs types.Transactions) { } } for peer, hashes := range txset { - directPeers++ directCount += len(hashes) peer.AsyncSendTransactions(hashes) } for peer, hashes := range annos { - annPeers++ annCount += len(hashes) peer.AsyncSendPooledTransactionHashes(hashes) } log.Debug("Distributed transactions", "plaintxs", len(txs)-blobTxs-largeTxs, "blobtxs", blobTxs, "largetxs", largeTxs, - "bcastpeers", directPeers, "bcastcount", directCount, "annpeers", annPeers, "anncount", annCount) + "bcastpeers", len(txset), "bcastcount", directCount, "annpeers", len(annos), "anncount", annCount) } // txBroadcastLoop announces new transactions to connected peers.