eth: simplify peer counting logic (#29420)
This commit is contained in:
parent
dfb3d46098
commit
7bb3fb1481
|
@ -466,9 +466,7 @@ func (h *handler) BroadcastTransactions(txs types.Transactions) {
|
||||||
largeTxs int // Number of large transactions to announce only
|
largeTxs int // Number of large transactions to announce only
|
||||||
|
|
||||||
directCount int // Number of transactions sent directly to peers (duplicates included)
|
directCount int // Number of transactions sent directly to peers (duplicates included)
|
||||||
directPeers int // Number of peers that were sent transactions directly
|
|
||||||
annCount int // Number of transactions announced across all peers (duplicates included)
|
annCount int // Number of transactions announced across all peers (duplicates included)
|
||||||
annPeers int // Number of peers announced about transactions
|
|
||||||
|
|
||||||
txset = make(map[*ethPeer][]common.Hash) // Set peer->hash to transfer directly
|
txset = make(map[*ethPeer][]common.Hash) // Set peer->hash to transfer directly
|
||||||
annos = make(map[*ethPeer][]common.Hash) // Set peer->hash to announce
|
annos = make(map[*ethPeer][]common.Hash) // Set peer->hash to announce
|
||||||
|
@ -525,17 +523,15 @@ func (h *handler) BroadcastTransactions(txs types.Transactions) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for peer, hashes := range txset {
|
for peer, hashes := range txset {
|
||||||
directPeers++
|
|
||||||
directCount += len(hashes)
|
directCount += len(hashes)
|
||||||
peer.AsyncSendTransactions(hashes)
|
peer.AsyncSendTransactions(hashes)
|
||||||
}
|
}
|
||||||
for peer, hashes := range annos {
|
for peer, hashes := range annos {
|
||||||
annPeers++
|
|
||||||
annCount += len(hashes)
|
annCount += len(hashes)
|
||||||
peer.AsyncSendPooledTransactionHashes(hashes)
|
peer.AsyncSendPooledTransactionHashes(hashes)
|
||||||
}
|
}
|
||||||
log.Debug("Distributed transactions", "plaintxs", len(txs)-blobTxs-largeTxs, "blobtxs", blobTxs, "largetxs", largeTxs,
|
log.Debug("Distributed transactions", "plaintxs", len(txs)-blobTxs-largeTxs, "blobtxs", blobTxs, "largetxs", largeTxs,
|
||||||
"bcastpeers", directPeers, "bcastcount", directCount, "annpeers", annPeers, "anncount", annCount)
|
"bcastpeers", len(txset), "bcastcount", directCount, "annpeers", len(annos), "anncount", annCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
// txBroadcastLoop announces new transactions to connected peers.
|
// txBroadcastLoop announces new transactions to connected peers.
|
||||||
|
|
Loading…
Reference in New Issue