mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-04 14:08:39 +00:00
Merge 123ce98ecc into 2522b716f4
This commit is contained in:
commit
b8f7081cb0
3 changed files with 11 additions and 7 deletions
|
|
@ -378,8 +378,9 @@ func (l *list) Filter(costLimit *uint256.Int, gasLimit uint64) (types.Transactio
|
||||||
l.gascap = gasLimit
|
l.gascap = gasLimit
|
||||||
|
|
||||||
// Filter out all the transactions above the account's funds
|
// Filter out all the transactions above the account's funds
|
||||||
|
costLimitBig := costLimit.ToBig()
|
||||||
removed := l.txs.Filter(func(tx *types.Transaction) bool {
|
removed := l.txs.Filter(func(tx *types.Transaction) bool {
|
||||||
return tx.Gas() > gasLimit || tx.Cost().Cmp(costLimit.ToBig()) > 0
|
return tx.Gas() > gasLimit || tx.Cost().Cmp(costLimitBig) > 0
|
||||||
})
|
})
|
||||||
|
|
||||||
if len(removed) == 0 {
|
if len(removed) == 0 {
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,8 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
|
||||||
}
|
}
|
||||||
// Transactions can't be negative. This may never happen using RLP decoded
|
// Transactions can't be negative. This may never happen using RLP decoded
|
||||||
// transactions but may occur for transactions created using the RPC.
|
// transactions but may occur for transactions created using the RPC.
|
||||||
if tx.Value().Sign() < 0 {
|
value := tx.Value()
|
||||||
|
if value.Sign() < 0 {
|
||||||
return ErrNegativeValue
|
return ErrNegativeValue
|
||||||
}
|
}
|
||||||
// Ensure the transaction doesn't exceed the current block limit gas
|
// Ensure the transaction doesn't exceed the current block limit gas
|
||||||
|
|
@ -105,14 +106,16 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
|
||||||
return ErrGasLimit
|
return ErrGasLimit
|
||||||
}
|
}
|
||||||
// Sanity check for extremely large numbers (supported by RLP or RPC)
|
// Sanity check for extremely large numbers (supported by RLP or RPC)
|
||||||
if tx.GasFeeCap().BitLen() > 256 {
|
feeCap := tx.GasFeeCap()
|
||||||
|
if feeCap.BitLen() > 256 {
|
||||||
return core.ErrFeeCapVeryHigh
|
return core.ErrFeeCapVeryHigh
|
||||||
}
|
}
|
||||||
if tx.GasTipCap().BitLen() > 256 {
|
tipCap := tx.GasTipCap()
|
||||||
|
if tipCap.BitLen() > 256 {
|
||||||
return core.ErrTipVeryHigh
|
return core.ErrTipVeryHigh
|
||||||
}
|
}
|
||||||
// Ensure gasFeeCap is greater than or equal to gasTipCap
|
// Ensure gasFeeCap is greater than or equal to gasTipCap
|
||||||
if tx.GasFeeCapIntCmp(tx.GasTipCap()) < 0 {
|
if feeCap.Cmp(tipCap) < 0 {
|
||||||
return core.ErrTipAboveFeeCap
|
return core.ErrTipAboveFeeCap
|
||||||
}
|
}
|
||||||
// Make sure the transaction is signed properly
|
// Make sure the transaction is signed properly
|
||||||
|
|
|
||||||
|
|
@ -478,12 +478,12 @@ func (tx *Transaction) BlobTxSidecar() *BlobTxSidecar {
|
||||||
|
|
||||||
// BlobGasFeeCapCmp compares the blob fee cap of two transactions.
|
// BlobGasFeeCapCmp compares the blob fee cap of two transactions.
|
||||||
func (tx *Transaction) BlobGasFeeCapCmp(other *Transaction) int {
|
func (tx *Transaction) BlobGasFeeCapCmp(other *Transaction) int {
|
||||||
return tx.BlobGasFeeCap().Cmp(other.BlobGasFeeCap())
|
return tx.inner.(*BlobTx).BlobFeeCap.Cmp(other.inner.(*BlobTx).BlobFeeCap)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BlobGasFeeCapIntCmp compares the blob fee cap of the transaction against the given blob fee cap.
|
// BlobGasFeeCapIntCmp compares the blob fee cap of the transaction against the given blob fee cap.
|
||||||
func (tx *Transaction) BlobGasFeeCapIntCmp(other *big.Int) int {
|
func (tx *Transaction) BlobGasFeeCapIntCmp(other *big.Int) int {
|
||||||
return tx.BlobGasFeeCap().Cmp(other)
|
return tx.inner.(*BlobTx).BlobFeeCap.CmpBig(other)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithoutBlobTxSidecar returns a copy of tx with the blob sidecar removed.
|
// WithoutBlobTxSidecar returns a copy of tx with the blob sidecar removed.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue