fix(rpc): add missing codes for witness (#11673)

This commit is contained in:
Francis Li
2024-10-11 10:55:22 -07:00
committed by GitHub
parent 0affb976a0
commit d8b7f6014f

View File

@@ -34,7 +34,7 @@ use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult};
use reth_tasks::pool::BlockingTaskGuard;
use reth_trie::{HashedPostState, HashedStorage};
use revm::{
db::CacheDB,
db::{CacheDB, State},
primitives::{db::DatabaseCommit, BlockEnv, CfgEnvWithHandlerCfg, Env, EnvWithHandlerCfg},
};
use revm_inspectors::tracing::{
@@ -614,12 +614,23 @@ where
let _ = block_executor
.execute_with_state_closure(
(&block.clone().unseal(), block.difficulty).into(),
|statedb| {
|statedb: &State<_>| {
codes = statedb
.cache
.contracts
.iter()
.map(|(hash, code)| (*hash, code.original_bytes()))
.chain(
// cache state does not have all the contracts, especially when
// a contract is created within the block
// the contract only exists in bundle state, therefore we need
// to include them as well
statedb
.bundle_state
.contracts
.iter()
.map(|(hash, code)| (*hash, code.original_bytes())),
)
.collect();
for (address, account) in &statedb.cache.accounts {