mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Revert "eth: send big transactions by announce/retrieve only (#27618)"
This reverts commit 60f192793e.
This commit is contained in:
parent
b02e2615e7
commit
e17719afa0
1 changed files with 1 additions and 10 deletions
|
|
@ -45,11 +45,6 @@ const (
|
||||||
// txChanSize is the size of channel listening to NewTxsEvent.
|
// txChanSize is the size of channel listening to NewTxsEvent.
|
||||||
// The number is referenced from the size of tx pool.
|
// The number is referenced from the size of tx pool.
|
||||||
txChanSize = 4096
|
txChanSize = 4096
|
||||||
|
|
||||||
// txMaxBroadcastSize is the max size of a transaction that will be broadcasted.
|
|
||||||
// All transactions with a higher size will be announced and need to be fetched
|
|
||||||
// by the peer.
|
|
||||||
txMaxBroadcastSize = 4096
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -569,12 +564,8 @@ func (h *handler) BroadcastTransactions(txs types.Transactions) {
|
||||||
// Broadcast transactions to a batch of peers not knowing about it
|
// Broadcast transactions to a batch of peers not knowing about it
|
||||||
for _, tx := range txs {
|
for _, tx := range txs {
|
||||||
peers := h.peers.peersWithoutTransaction(tx.Hash())
|
peers := h.peers.peersWithoutTransaction(tx.Hash())
|
||||||
|
|
||||||
var numDirect int
|
|
||||||
if tx.Size() <= txMaxBroadcastSize {
|
|
||||||
numDirect = int(math.Sqrt(float64(len(peers))))
|
|
||||||
}
|
|
||||||
// Send the tx unconditionally to a subset of our peers
|
// Send the tx unconditionally to a subset of our peers
|
||||||
|
numDirect := int(math.Sqrt(float64(len(peers))))
|
||||||
for _, peer := range peers[:numDirect] {
|
for _, peer := range peers[:numDirect] {
|
||||||
txset[peer] = append(txset[peer], tx.Hash())
|
txset[peer] = append(txset[peer], tx.Hash())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue