refactor(rpc): simplifications with DatabaseRef calls (#12294)

This commit is contained in:
Thomas Coratger
2024-11-06 10:45:00 +01:00
committed by GitHub
parent 1a091a7643
commit f1ac9b87b8
2 changed files with 3 additions and 2 deletions

View File

@ -265,7 +265,7 @@ where
{
// we need to fetch the account via the `DatabaseRef` to not update the state of the account,
// which is modified via `Database::basic_ref`
let mut account_info = DatabaseRef::basic_ref(db, account)?.unwrap_or_default();
let mut account_info = db.basic_ref(account)?.unwrap_or_default();
if let Some(nonce) = account_override.nonce {
account_info.nonce = nonce;

View File

@ -156,7 +156,8 @@ where
let env = EnvWithHandlerCfg::new_with_cfg_env(cfg, block_env, TxEnv::default());
let db = CacheDB::new(StateProviderDatabase::new(state));
let initial_coinbase = DatabaseRef::basic_ref(&db, coinbase)
let initial_coinbase = db
.basic_ref(coinbase)
.map_err(Eth::Error::from_eth_err)?
.map(|acc| acc.balance)
.unwrap_or_default();