Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

Commit

Permalink
allow reuse of blockhash
Browse files Browse the repository at this point in the history
  • Loading branch information
calbera committed May 24, 2023
1 parent fc19d4f commit fee9e00
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,11 @@ func ApplyTransactionWithEVM(

func ApplyTransactionWithEVMWithResult(
vmenv *vm.EVM, config *params.ChainConfig, gp *GasPool, statedb state.StateDBI,
header *types.Header, tx *types.Transaction, usedGas *uint64,
baseFee *big.Int, blockNumber *big.Int, blockHash common.Hash, tx *types.Transaction, usedGas *uint64,
) (*types.Receipt, *ExecutionResult, error) {
msg, err := TransactionToMessage(tx, types.MakeSigner(config, header.Number), header.BaseFee)
msg, err := TransactionToMessage(tx, types.MakeSigner(config, blockNumber), baseFee)
if err != nil {
return nil, nil, err
}
return applyTransactionWithResult(vmenv, msg, config, gp, statedb, header.Number, header.Hash(), tx, usedGas)
return applyTransactionWithResult(vmenv, msg, config, gp, statedb, blockNumber, blockHash, tx, usedGas)
}
3 changes: 2 additions & 1 deletion ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2201,6 +2201,7 @@ func (s *BundleAPI) CallBundle(ctx context.Context, args CallBundleArgs) (map[st
Coinbase: coinbase,
BaseFee: baseFee,
}
blockHash := header.Hash()

// Setup context so it may be cancelled the call has completed
// or, in case of unmetered gas, setup a context with a timeout.
Expand Down Expand Up @@ -2241,7 +2242,7 @@ func (s *BundleAPI) CallBundle(ctx context.Context, args CallBundleArgs) (map[st
state.SetTxContext(tx.Hash(), i)

receipt, result, err := core.ApplyTransactionWithEVMWithResult(
vmenv, s.b.ChainConfig(), gp, state, header, tx, &header.GasUsed,
vmenv, s.b.ChainConfig(), gp, state, header.BaseFee, header.Number, blockHash, tx, &header.GasUsed,
)
if err != nil {
return nil, fmt.Errorf("err: %w; txhash %s", err, tx.Hash())
Expand Down

0 comments on commit fee9e00

Please sign in to comment.