mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
core/txpool: use the cached address in ValidateTransactionWithState
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.
goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/core/txpool/legacypool
cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
│ old.txt │ new.txt │
│ sec/op │ sec/op vs base │
BatchInsert100-8 11.671m ± 29% 7.731m ± 34% -33.76% (p=0.000 n=10)
BatchInsert1000-8 140.62m ± 17% 72.54m ± 5% -48.42% (p=0.000 n=10)
BatchInsert10000-8 1384.3m ± 7% 709.5m ± 1% -48.75% (p=0.000 n=10)
geomean 131.5m 73.55m -44.05%
This commit is contained in:
parent
380688c636
commit
c979e1ef96
1 changed files with 1 additions and 1 deletions
|
|
@ -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…
Reference in a new issue