From b74ae835e9356817ba60db3da39dc4ce81691ca1 Mon Sep 17 00:00:00 2001 From: Jason Paryani Date: Tue, 15 Jun 2021 10:20:22 -0700 Subject: [PATCH] flashbots: count eth payments for txs whose nonce is in the mempool Fixes #76 --- miner/worker.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/miner/worker.go b/miner/worker.go index f7631fc14e5b..879ccb7fc70b 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -1358,16 +1358,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) } }