Skip to content

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 committed Aug 24, 2021
1 parent f4b771b commit 27360e3
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 27360e3

Please sign in to comment.