eth/protocols/eth: replace array with counter in txn broadcaster (#23656)

This commit is contained in:
Ferran Borreguero 2021-10-04 16:10:51 +02:00 committed by GitHub
parent 5a0e1d88f4
commit 0dbb3b1601
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,7 +75,7 @@ func (p *Peer) broadcastTransactions() {
if done == nil && len(queue) > 0 {
// Pile transaction until we reach our allowed network limit
var (
hashes []common.Hash
hashesCount uint64
txs []*types.Transaction
size common.StorageSize
)
@ -84,9 +84,9 @@ func (p *Peer) broadcastTransactions() {
txs = append(txs, tx)
size += tx.Size()
}
hashes = append(hashes, queue[i])
hashesCount++
}
queue = queue[:copy(queue, queue[len(hashes):])]
queue = queue[:copy(queue, queue[hashesCount:])]
// If there's anything available to transfer, fire up an async writer
if len(txs) > 0 {