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

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.
pull/30216/head
minh-bq 2 months ago committed by GitHub
parent 7026bae17c
commit 6693fe1be2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      core/txpool/validation.go

@ -201,7 +201,7 @@ type ValidationOptionsWithState struct {
// rules without duplicating code and running the risk of missed updates. // rules without duplicating code and running the risk of missed updates.
func ValidateTransactionWithState(tx *types.Transaction, signer types.Signer, opts *ValidationOptionsWithState) error { func ValidateTransactionWithState(tx *types.Transaction, signer types.Signer, opts *ValidationOptionsWithState) error {
// Ensure the transaction adheres to nonce ordering // 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 { if err != nil {
log.Error("Transaction sender recovery failed", "err", err) log.Error("Transaction sender recovery failed", "err", err)
return err return err

Loading…
Cancel
Save