Skip to content

Commit fe10c37

Browse files
cskiraly0g-wh
authored andcommitted
eth: fix transaction sender cache miss before broadcast (ethereum#31657)
BroadcastTransactions needs the Sender address to route message flows from the same Sender address consistently to the same random subset of peers. It however spent considerable time calculating the Sender addresses, even if the Sender address was already calculated and cached in other parts of the code. Since we only need the mapping, we can use any signer, and the one that had already been used is a better choice because of cache reuse.
1 parent 7de96f9 commit fe10c37

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

eth/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ func (h *handler) BroadcastTransactions(txs types.Transactions) {
484484
total := new(big.Int).Exp(direct, big.NewInt(2), nil) // Stabilise total peer count a bit based on sqrt peers
485485

486486
var (
487-
signer = types.LatestSignerForChainID(h.chain.Config().ChainID) // Don't care about chain status, we just need *a* sender
487+
signer = types.LatestSigner(h.chain.Config()) // Don't care about chain status, we just need *a* sender
488488
hasher = crypto.NewKeccakState()
489489
hash = make([]byte, 32)
490490
)

0 commit comments

Comments
 (0)