Skip to content

Commit 0dbb3b1

Browse files
authored
eth/protocols/eth: replace array with counter in txn broadcaster (ethereum#23656)
1 parent 5a0e1d8 commit 0dbb3b1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

eth/protocols/eth/broadcast.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,18 @@ func (p *Peer) broadcastTransactions() {
7575
if done == nil && len(queue) > 0 {
7676
// Pile transaction until we reach our allowed network limit
7777
var (
78-
hashes []common.Hash
79-
txs []*types.Transaction
80-
size common.StorageSize
78+
hashesCount uint64
79+
txs []*types.Transaction
80+
size common.StorageSize
8181
)
8282
for i := 0; i < len(queue) && size < maxTxPacketSize; i++ {
8383
if tx := p.txpool.Get(queue[i]); tx != nil {
8484
txs = append(txs, tx)
8585
size += tx.Size()
8686
}
87-
hashes = append(hashes, queue[i])
87+
hashesCount++
8888
}
89-
queue = queue[:copy(queue, queue[len(hashes):])]
89+
queue = queue[:copy(queue, queue[hashesCount:])]
9090

9191
// If there's anything available to transfer, fire up an async writer
9292
if len(txs) > 0 {

0 commit comments

Comments
 (0)