mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 13:16:42 +00:00
core/txpool: add nonce eip-2681 check
This commit is contained in:
parent
2872242045
commit
308f7a3dbc
1 changed files with 4 additions and 0 deletions
|
|
@ -116,6 +116,10 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
|
||||||
if _, err := types.Sender(signer, tx); err != nil {
|
if _, err := types.Sender(signer, tx); err != nil {
|
||||||
return fmt.Errorf("%w: %v", ErrInvalidSender, err)
|
return fmt.Errorf("%w: %v", ErrInvalidSender, err)
|
||||||
}
|
}
|
||||||
|
// Limit nonce to 2^64-1 per EIP-2681
|
||||||
|
if tx.Nonce()+1 < tx.Nonce() {
|
||||||
|
return core.ErrNonceMax
|
||||||
|
}
|
||||||
// Ensure the transaction has more gas than the bare minimum needed to cover
|
// Ensure the transaction has more gas than the bare minimum needed to cover
|
||||||
// the transaction metadata
|
// the transaction metadata
|
||||||
intrGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil, true, rules.IsIstanbul, rules.IsShanghai)
|
intrGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil, true, rules.IsIstanbul, rules.IsShanghai)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue