Skip to content

Commit 3b6c990

Browse files
Rob Mulholandkaralabe
authored andcommitted
core: remove unused gas return in ApplyTransaction (#20065)
1 parent efe1237 commit 3b6c990

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

cmd/geth/retesteth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ func (api *RetestethAPI) mineBlock() error {
508508
statedb.Prepare(tx.Hash(), common.Hash{}, txCount)
509509
snap := statedb.Snapshot()
510510

511-
receipt, _, err := core.ApplyTransaction(
511+
receipt, err := core.ApplyTransaction(
512512
api.chainConfig,
513513
api.blockchain,
514514
&api.author,

core/chain_makers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func (b *BlockGen) AddTxWithChain(bc *BlockChain, tx *types.Transaction) {
103103
b.SetCoinbase(common.Address{})
104104
}
105105
b.statedb.Prepare(tx.Hash(), common.Hash{}, len(b.txs))
106-
receipt, _, err := ApplyTransaction(b.config, bc, &b.header.Coinbase, b.gasPool, b.statedb, b.header, tx, &b.header.GasUsed, vm.Config{})
106+
receipt, err := ApplyTransaction(b.config, bc, &b.header.Coinbase, b.gasPool, b.statedb, b.header, tx, &b.header.GasUsed, vm.Config{})
107107
if err != nil {
108108
panic(err)
109109
}

core/state_processor.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
6868
// Iterate over and process the individual transactions
6969
for i, tx := range block.Transactions() {
7070
statedb.Prepare(tx.Hash(), block.Hash(), i)
71-
receipt, _, err := ApplyTransaction(p.config, p.bc, nil, gp, statedb, header, tx, usedGas, cfg)
71+
receipt, err := ApplyTransaction(p.config, p.bc, nil, gp, statedb, header, tx, usedGas, cfg)
7272
if err != nil {
7373
return nil, nil, 0, err
7474
}
@@ -85,10 +85,10 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
8585
// and uses the input parameters for its environment. It returns the receipt
8686
// for the transaction, gas used and an error if the transaction failed,
8787
// indicating the block was invalid.
88-
func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *common.Address, gp *GasPool, statedb *state.StateDB, header *types.Header, tx *types.Transaction, usedGas *uint64, cfg vm.Config) (*types.Receipt, uint64, error) {
88+
func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *common.Address, gp *GasPool, statedb *state.StateDB, header *types.Header, tx *types.Transaction, usedGas *uint64, cfg vm.Config) (*types.Receipt, error) {
8989
msg, err := tx.AsMessage(types.MakeSigner(config, header.Number))
9090
if err != nil {
91-
return nil, 0, err
91+
return nil, err
9292
}
9393
// Create a new context to be used in the EVM environment
9494
context := NewEVMContext(msg, header, bc, author)
@@ -98,7 +98,7 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
9898
// Apply the transaction to the current state (included in the env)
9999
_, gas, failed, err := ApplyMessage(vmenv, msg, gp)
100100
if err != nil {
101-
return nil, 0, err
101+
return nil, err
102102
}
103103
// Update the state with pending changes
104104
var root []byte
@@ -125,5 +125,5 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
125125
receipt.BlockNumber = header.Number
126126
receipt.TransactionIndex = uint(statedb.TxIndex())
127127

128-
return receipt, gas, err
128+
return receipt, err
129129
}

miner/worker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ func (w *worker) updateSnapshot() {
704704
func (w *worker) commitTransaction(tx *types.Transaction, coinbase common.Address) ([]*types.Log, error) {
705705
snap := w.current.state.Snapshot()
706706

707-
receipt, _, err := core.ApplyTransaction(w.chainConfig, w.chain, &coinbase, w.current.gasPool, w.current.state, w.current.header, tx, &w.current.header.GasUsed, *w.chain.GetVMConfig())
707+
receipt, err := core.ApplyTransaction(w.chainConfig, w.chain, &coinbase, w.current.gasPool, w.current.state, w.current.header, tx, &w.current.header.GasUsed, *w.chain.GetVMConfig())
708708
if err != nil {
709709
w.current.state.RevertToSnapshot(snap)
710710
return nil, err

0 commit comments

Comments
 (0)