mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
perf: query accounts with &Address to avoid copying address (#13554)
This commit is contained in:
@ -87,7 +87,7 @@ pub trait EstimateCall: Call {
|
||||
// Optimize for simple transfer transactions, potentially reducing the gas estimate.
|
||||
if env.tx.data.is_empty() {
|
||||
if let TransactTo::Call(to) = env.tx.transact_to {
|
||||
if let Ok(code) = db.db.account_code(to) {
|
||||
if let Ok(code) = db.db.account_code(&to) {
|
||||
let no_code_callee = code.map(|code| code.is_empty()).unwrap_or(true);
|
||||
if no_code_callee {
|
||||
// If the tx is a simple transfer (call to an account with no code) we can
|
||||
|
||||
@ -53,7 +53,7 @@ pub trait EthState: LoadState + SpawnBlocking {
|
||||
self.spawn_blocking_io(move |this| {
|
||||
Ok(this
|
||||
.state_at_block_id_or_latest(block_id)?
|
||||
.account_balance(address)
|
||||
.account_balance(&address)
|
||||
.map_err(Self::Error::from_eth_err)?
|
||||
.unwrap_or_default())
|
||||
})
|
||||
@ -131,7 +131,7 @@ pub trait EthState: LoadState + SpawnBlocking {
|
||||
) -> impl Future<Output = Result<Option<Account>, Self::Error>> + Send {
|
||||
self.spawn_blocking_io(move |this| {
|
||||
let state = this.state_at_block_id(block_id)?;
|
||||
let account = state.basic_account(address).map_err(Self::Error::from_eth_err)?;
|
||||
let account = state.basic_account(&address).map_err(Self::Error::from_eth_err)?;
|
||||
let Some(account) = account else { return Ok(None) };
|
||||
|
||||
// Check whether the distance to the block exceeds the maximum configured proof window.
|
||||
@ -252,7 +252,7 @@ pub trait LoadState:
|
||||
// first fetch the on chain nonce of the account
|
||||
let on_chain_account_nonce = this
|
||||
.latest_state()?
|
||||
.account_nonce(address)
|
||||
.account_nonce(&address)
|
||||
.map_err(Self::Error::from_eth_err)?
|
||||
.unwrap_or_default();
|
||||
|
||||
@ -290,7 +290,7 @@ pub trait LoadState:
|
||||
// first fetch the on chain nonce of the account
|
||||
let on_chain_account_nonce = this
|
||||
.state_at_block_id_or_latest(block_id)?
|
||||
.account_nonce(address)
|
||||
.account_nonce(&address)
|
||||
.map_err(Self::Error::from_eth_err)?
|
||||
.unwrap_or_default();
|
||||
|
||||
@ -333,7 +333,7 @@ pub trait LoadState:
|
||||
self.spawn_blocking_io(move |this| {
|
||||
Ok(this
|
||||
.state_at_block_id_or_latest(block_id)?
|
||||
.account_code(address)
|
||||
.account_code(&address)
|
||||
.map_err(Self::Error::from_eth_err)?
|
||||
.unwrap_or_default()
|
||||
.original_bytes())
|
||||
|
||||
Reference in New Issue
Block a user