@@ -565,26 +565,19 @@ func (h *handler) BroadcastTransactions(txs types.Transactions) {
565
565
// ReannounceTransactions will announce a batch of local pending transactions
566
566
// to a square root of all peers.
567
567
func (h * handler ) ReannounceTransactions (txs types.Transactions ) {
568
- var (
569
- annoCount int // Count of announcements made
570
- annos = make ( map [ * ethPeer ][]common .Hash ) // Set peer->hash to announce
571
- )
568
+ hashes := make ([]common. Hash , 0 , txs . Len ())
569
+ for _ , tx := range txs {
570
+ hashes = append ( hashes , tx .Hash ())
571
+ }
572
572
573
573
// Announce transactions hash to a batch of peers
574
574
peersCount := uint (math .Sqrt (float64 (h .peers .len ())))
575
575
peers := h .peers .headPeers (peersCount )
576
- for _ , tx := range txs {
577
- for _ , peer := range peers {
578
- annos [peer ] = append (annos [peer ], tx .Hash ())
579
- }
580
- }
581
-
582
- for peer , hashes := range annos {
583
- annoCount += len (hashes )
576
+ for _ , peer := range peers {
584
577
peer .AsyncSendPooledTransactionHashes (hashes )
585
578
}
586
579
log .Debug ("Transaction reannounce" , "txs" , len (txs ),
587
- "announce packs" , peersCount , "announced hashes" , annoCount )
580
+ "announce packs" , peersCount , "announced hashes" , peersCount * uint ( len ( hashes )) )
588
581
}
589
582
590
583
// minedBroadcastLoop sends mined blocks to connected peers.
0 commit comments