Skip to content

Commit

Permalink
Merge pull request #63 from mantlenetworkio/bugfix/replacement-sum-check
Browse files Browse the repository at this point in the history
R4R: fix balance check in tx replacement for metatx
  • Loading branch information
idyllsss committed Mar 11, 2024
2 parents 468d164 + b17e053 commit f458046
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/txpool/txpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,15 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
if l1Cost := pool.l1CostFn(tx.RollupDataGas(), tx.IsDepositTx(), tx.To()); l1Cost != nil { // add rollup cost
replL1Cost = replL1Cost.Add(cost, l1Cost)
}
replMetaTxParams, err := types.DecodeAndVerifyMetaTxParams(repl, pool.chainconfig.IsMetaTxV2(pool.chain.CurrentBlock().Time))
if err != nil {
return err
}
if replMetaTxParams != nil {
replTxGasCost := new(big.Int).Sub(repl.Cost(), repl.Value())
sponsorAmount, _ := types.CalculateSponsorPercentAmount(replMetaTxParams, replTxGasCost)
replL1Cost = new(big.Int).Sub(replL1Cost, sponsorAmount)
}
sum.Sub(sum, replL1Cost)
}
if userBalance.Cmp(sum) < 0 {
Expand Down

0 comments on commit f458046

Please sign in to comment.