Skip to content

Commit

Permalink
Added code to state processor.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frozen committed Sep 17, 2024
1 parent 2c738bb commit 9ddc0cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ func ApplyTransaction(bc ChainContext, author *common.Address, gp *GasPool, stat
receipt := types.NewReceipt(root, failedExe, *usedGas)
receipt.TxHash = tx.Hash()
receipt.GasUsed = result.UsedGas
receipt.EffectiveGasPrice = tx.EffectiveGasPrice(big.NewInt(0), nil)
// if the transaction created a contract, store the creation address in the receipt.
if msg.To() == nil {
receipt.ContractAddress = crypto.CreateAddress(vmenv.Context.Origin, tx.Nonce())
Expand Down
5 changes: 5 additions & 0 deletions core/types/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,11 @@ func (tx *Transaction) SenderAddress() (common.Address, error) {
return addr, nil
}

// EffectiveGasPrice returns the effective gas price of the transaction.
func (tx *Transaction) EffectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
return tx.data.effectiveGasPrice(dst, baseFee)
}

// TxByNonce implements the sort interface to allow sorting a list of transactions
// by their nonces. This is usually only useful for sorting transactions from a
// single account, otherwise a nonce comparison doesn't make much sense.
Expand Down

0 comments on commit 9ddc0cd

Please sign in to comment.