Skip to content

Commit 5b7079b

Browse files
authored
fix(tx-pool): consider L1 data fee in validateTx (#609)
* fix(tx-pool): consider L1 data fee in validateTx * bump version
1 parent 640b391 commit 5b7079b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

core/tx_pool.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -658,9 +658,14 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
658658
if pool.currentState.GetNonce(from) > tx.Nonce() {
659659
return ErrNonceTooLow
660660
}
661+
// Get L1 data fee in current state
662+
l1DataFee, err := fees.CalculateL1DataFee(tx, pool.currentState)
663+
if err != nil {
664+
return fmt.Errorf("failed to calculate L1 data fee, err: %w", err)
665+
}
661666
// Transactor should have enough funds to cover the costs
662667
// cost == V + GP * GL
663-
if pool.currentState.GetBalance(from).Cmp(tx.Cost()) < 0 {
668+
if pool.currentState.GetBalance(from).Cmp(new(big.Int).Add(tx.Cost(), l1DataFee)) < 0 {
664669
return ErrInsufficientFunds
665670
}
666671
// Ensure the transaction has more gas than the basic tx fee.

params/version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
const (
2525
VersionMajor = 5 // Major version component of the current release
2626
VersionMinor = 1 // Minor version component of the current release
27-
VersionPatch = 9 // Patch version component of the current release
27+
VersionPatch = 10 // Patch version component of the current release
2828
VersionMeta = "mainnet" // Version metadata to append to the version string
2929
)
3030

0 commit comments

Comments
 (0)