Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
flashbots: count eth payments for txs whose nonce is in the mempool
Browse files Browse the repository at this point in the history
  • Loading branch information
jparyani authored and frostRed committed Aug 16, 2021
1 parent 762ba76 commit ec98761
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1394,16 +1394,16 @@ func (w *worker) computeBundleGas(bundle types.MevBundle, parent *types.Block, h
}
}

gasUsed := new(big.Int).SetUint64(receipt.GasUsed)
gasFeesTx := gasUsed.Mul(gasUsed, tx.GasPrice())
coinbaseBalanceAfter := state.GetBalance(w.coinbase)
coinbaseDelta := big.NewInt(0).Sub(coinbaseBalanceAfter, coinbaseBalanceBefore)
coinbaseDelta.Sub(coinbaseDelta, gasFeesTx)
ethSentToCoinbase.Add(ethSentToCoinbase, coinbaseDelta)

if !txInPendingPool {
// If tx is not in pending pool, count the gas fees
gasUsed := new(big.Int).SetUint64(receipt.GasUsed)
gasFeesTx := gasUsed.Mul(gasUsed, tx.GasPrice())
gasFees.Add(gasFees, gasFeesTx)

coinbaseBalanceAfter := state.GetBalance(w.coinbase)
coinbaseDelta := big.NewInt(0).Sub(coinbaseBalanceAfter, coinbaseBalanceBefore)
coinbaseDelta.Sub(coinbaseDelta, gasFeesTx)
ethSentToCoinbase.Add(ethSentToCoinbase, coinbaseDelta)
}
}

Expand Down

0 comments on commit ec98761

Please sign in to comment.