pool: add back removed logic
This commit is contained in:
parent
355dee9000
commit
1ad40cda3f
@ -851,8 +851,7 @@ func (h *handler) BroadcastTransactions(txs types.Transactions) {
|
||||
txset = make(map[*ethPeer][]common.Hash) // Set peer->hash to transfer directly
|
||||
annos = make(map[*ethPeer][]common.Hash) // Set peer->hash to announce
|
||||
)
|
||||
// for pool2 it is p = static+sqrt(peers) is total available.
|
||||
// Send tx to sqrt(p) and announce to (p - sqrt(p)) peers
|
||||
|
||||
// Broadcast transactions to a batch of peers not knowing about it
|
||||
for _, tx := range txs {
|
||||
peers := h.peers.peersWithoutTransaction(tx.Hash())
|
||||
@ -866,7 +865,6 @@ func (h *handler) BroadcastTransactions(txs types.Transactions) {
|
||||
default:
|
||||
numDirect = int(math.Sqrt(float64(len(peers))))
|
||||
}
|
||||
|
||||
// Send the tx unconditionally to a subset of our peers
|
||||
for _, peer := range peers[:numDirect] {
|
||||
txset[peer] = append(txset[peer], tx.Hash())
|
||||
|
@ -224,6 +224,9 @@ func (p *Peer) SendTransactions(txs types.Transactions) error {
|
||||
// will force old sends to be dropped)
|
||||
func (p *Peer) AsyncSendTransactions(hashes []common.Hash) {
|
||||
select {
|
||||
case p.txBroadcast <- hashes:
|
||||
// Mark all the transactions as known, but ensure we don't overflow our limits
|
||||
p.knownTxs.Add(hashes...)
|
||||
case <-p.txTerm:
|
||||
p.Log().Debug("Dropping transaction propagation", "count", len(hashes))
|
||||
case <-p.term:
|
||||
|
Loading…
Reference in New Issue
Block a user