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 chpiatt committed Aug 24, 2021
1 parent d53e731 commit 8b1b6e2
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 8b1b6e2

Please sign in to comment.