mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
fix : callWithState
This commit is contained in:
parent
4008d5efe8
commit
7839c39005
2 changed files with 15 additions and 6 deletions
|
|
@ -1367,11 +1367,20 @@ func (e *revertError) ErrorData() interface{} {
|
||||||
// Note, this function doesn't make and changes in the state/blockchain and is
|
// Note, this function doesn't make and changes in the state/blockchain and is
|
||||||
// useful to execute and retrieve values.
|
// useful to execute and retrieve values.
|
||||||
func (s *BlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, overrides *StateOverride, blockOverrides *BlockOverrides) (hexutil.Bytes, error) {
|
func (s *BlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, overrides *StateOverride, blockOverrides *BlockOverrides) (hexutil.Bytes, error) {
|
||||||
if blockNrOrHash == nil {
|
return s.CallWithState(ctx, args, *blockNrOrHash, nil, overrides, blockOverrides)
|
||||||
latest := rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber)
|
|
||||||
blockNrOrHash = &latest
|
|
||||||
}
|
}
|
||||||
result, err := DoCall(ctx, s.b, args, *blockNrOrHash, overrides, blockOverrides, s.b.RPCEVMTimeout(), s.b.RPCGasCap())
|
|
||||||
|
// CallWithState executes the given transaction on the given state for
|
||||||
|
// the given block number. Note that as it does an EVM call, fields in
|
||||||
|
// the underlying state will change. Make sure to handle it outside of
|
||||||
|
// this function (ideally by sending a copy of state).
|
||||||
|
//
|
||||||
|
// Additionally, the caller can specify a batch of contract for fields overriding.
|
||||||
|
//
|
||||||
|
// Note, this function doesn't make and changes in the state/blockchain and is
|
||||||
|
// useful to execute and retrieve values.
|
||||||
|
func (s *BlockChainAPI) CallWithState(ctx context.Context, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, state *state.StateDB, overrides *StateOverride, blockOverrides *BlockOverrides) (hexutil.Bytes, error) {
|
||||||
|
result, err := DoCall(ctx, s.b, args, blockNrOrHash, state, overrides, blockOverrides, s.b.RPCEVMTimeout(), s.b.RPCGasCap())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -512,7 +512,7 @@ func (w *worker) commitTransactionsWithDelay(env *environment, txs *transactions
|
||||||
|
|
||||||
var depsWg sync.WaitGroup
|
var depsWg sync.WaitGroup
|
||||||
|
|
||||||
EnableMVHashMap := w.chainConfig.Bor.IsParallelUniverse(env.header.Number)
|
EnableMVHashMap := w.chainConfig.IsCancun(env.header.Number)
|
||||||
|
|
||||||
// create and add empty mvHashMap in statedb
|
// create and add empty mvHashMap in statedb
|
||||||
if EnableMVHashMap {
|
if EnableMVHashMap {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue