mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
eth: remove append
This commit is contained in:
parent
411b6716d6
commit
4cef22cba6
1 changed files with 3 additions and 4 deletions
|
|
@ -709,17 +709,16 @@ func newBroadcastChoice(self enode.ID) *broadcastChoice {
|
|||
}
|
||||
|
||||
// choosePeers selects the peers that will receive a direct transaction broadcast message.
|
||||
//
|
||||
// Note the return value will only stay valid until the next call to choosePeers.
|
||||
func (bc *broadcastChoice) choosePeers(peers []*ethPeer, txSender common.Address) map[*ethPeer]struct{} {
|
||||
// Compute scores.
|
||||
bc.tmp = bc.tmp[:0]
|
||||
for _, peer := range peers {
|
||||
bc.tmp = slices.Grow(bc.tmp[:0], len(peers))[:len(peers)]
|
||||
for i, peer := range peers {
|
||||
bc.hash.Reset()
|
||||
bc.hash.Write(bc.self[:])
|
||||
bc.hash.Write(peer.Peer.Peer.ID().Bytes())
|
||||
bc.hash.Write(txSender[:])
|
||||
bc.tmp = append(bc.tmp, broadcastPeer{peer, bc.hash.Sum64()})
|
||||
bc.tmp[i] = broadcastPeer{peer, bc.hash.Sum64()}
|
||||
}
|
||||
|
||||
// Sort by score.
|
||||
|
|
|
|||
Loading…
Reference in a new issue