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 Jun 16, 2021
1 parent ceab2ea commit b74ae83
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 @@ -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)
}
}

Expand Down

0 comments on commit b74ae83

Please sign in to comment.