perf(core/txpool): use the cached address in ValidateTransactionWithState #30208 (#2166)

The address recover is executed and cached in ValidateTransaction already. It's
expected that the cached one is returned in ValidateTransaction. However,
currently, we use the wrong function signer.Sender instead of types.Sender which
will do all the address recover again.

Co-authored-by: minh-bq <97180373+minh-bq@users.noreply.github.com>
This commit is contained in:
Daniel Liu 2026-03-17 13:47:27 +08:00 committed by GitHub
parent 1ac34cbac3
commit 7d3e73951f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -177,7 +177,7 @@ type ValidationOptionsWithState struct {
// rules without duplicating code and running the risk of missed updates.
func ValidateTransactionWithState(tx *types.Transaction, signer types.Signer, opts *ValidationOptionsWithState) error {
// Ensure the transaction adheres to nonce ordering
from, err := signer.Sender(tx) // already validated (and cached), but cleaner to check
from, err := types.Sender(signer, tx) // already validated (and cached), but cleaner to check
if err != nil {
log.Error("Transaction sender recovery failed", "err", err)
return err