@@ -142,7 +142,7 @@ func applyTransaction(msg *Message, config *params.ChainConfig, gp *GasPool, sta
142142 return receipt , err
143143}
144144
145- func applyTransactionWithResult (msg types. Message , config * params.ChainConfig , bc ChainContext , author * common. Address , gp * GasPool , statedb * state.StateDB , header * types. Header , tx * types.Transaction , usedGas * uint64 , evm * vm.EVM ) (* types.Receipt , * ExecutionResult , error ) {
145+ func applyTransactionWithResult (msg * Message , config * params.ChainConfig , gp * GasPool , statedb * state.StateDB , blockNumber * big. Int , blockHash common. Hash , tx * types.Transaction , usedGas * uint64 , evm * vm.EVM ) (* types.Receipt , * ExecutionResult , error ) {
146146 // Create a new context to be used in the EVM environment.
147147 txContext := NewEVMTxContext (msg )
148148 evm .Reset (txContext , statedb )
@@ -155,10 +155,10 @@ func applyTransactionWithResult(msg types.Message, config *params.ChainConfig, b
155155
156156 // Update the state with pending changes.
157157 var root []byte
158- if config .IsByzantium (header . Number ) {
158+ if config .IsByzantium (blockNumber ) {
159159 statedb .Finalise (true )
160160 } else {
161- root = statedb .IntermediateRoot (config .IsEIP158 (header . Number )).Bytes ()
161+ root = statedb .IntermediateRoot (config .IsEIP158 (blockNumber )).Bytes ()
162162 }
163163 * usedGas += result .UsedGas
164164
@@ -174,15 +174,15 @@ func applyTransactionWithResult(msg types.Message, config *params.ChainConfig, b
174174 receipt .GasUsed = result .UsedGas
175175
176176 // If the transaction created a contract, store the creation address in the receipt.
177- if msg .To () == nil {
177+ if msg .To == nil {
178178 receipt .ContractAddress = crypto .CreateAddress (evm .TxContext .Origin , tx .Nonce ())
179179 }
180180
181181 // Set the receipt logs and create the bloom filter.
182- receipt .Logs = statedb .GetLogs (tx .Hash (), header . Hash () )
182+ receipt .Logs = statedb .GetLogs (tx .Hash (), blockNumber . Uint64 (), blockHash )
183183 receipt .Bloom = types .CreateBloom (types.Receipts {receipt })
184- receipt .BlockHash = header . Hash ()
185- receipt .BlockNumber = header . Number
184+ receipt .BlockHash = blockHash
185+ receipt .BlockNumber = blockNumber
186186 receipt .TransactionIndex = uint (statedb .TxIndex ())
187187 return receipt , result , err
188188}
@@ -203,12 +203,12 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
203203}
204204
205205func ApplyTransactionWithResult (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 , * ExecutionResult , error ) {
206- msg , err := tx . AsMessage ( types .MakeSigner (config , header .Number ), header .BaseFee )
206+ msg , err := TransactionToMessage ( tx , types .MakeSigner (config , header .Number ), header .BaseFee )
207207 if err != nil {
208208 return nil , nil , err
209209 }
210210 // Create a new context to be used in the EVM environment
211211 blockContext := NewEVMBlockContext (header , bc , author )
212212 vmenv := vm .NewEVM (blockContext , vm.TxContext {}, statedb , config , cfg )
213- return applyTransactionWithResult (msg , config , bc , author , gp , statedb , header , tx , usedGas , vmenv )
213+ return applyTransactionWithResult (msg , config , gp , statedb , header . Number , header . Hash () , tx , usedGas , vmenv )
214214}
0 commit comments