mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
refactor(rpc): simplifications with DatabaseRef calls (#12294)
This commit is contained in:
@ -265,7 +265,7 @@ where
|
|||||||
{
|
{
|
||||||
// we need to fetch the account via the `DatabaseRef` to not update the state of the account,
|
// we need to fetch the account via the `DatabaseRef` to not update the state of the account,
|
||||||
// which is modified via `Database::basic_ref`
|
// 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 {
|
if let Some(nonce) = account_override.nonce {
|
||||||
account_info.nonce = nonce;
|
account_info.nonce = nonce;
|
||||||
|
|||||||
@ -156,7 +156,8 @@ where
|
|||||||
let env = EnvWithHandlerCfg::new_with_cfg_env(cfg, block_env, TxEnv::default());
|
let env = EnvWithHandlerCfg::new_with_cfg_env(cfg, block_env, TxEnv::default());
|
||||||
let db = CacheDB::new(StateProviderDatabase::new(state));
|
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_err(Eth::Error::from_eth_err)?
|
||||||
.map(|acc| acc.balance)
|
.map(|acc| acc.balance)
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|||||||
Reference in New Issue
Block a user