Skip to content

Commit 1c7cd9d

Browse files
authored
fix: use existing functions for accountinfo (#11134)
1 parent 1aef588 commit 1c7cd9d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

crates/anvil/src/eth/api.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ use revm::{
9696
primitives::eip7702::PER_EMPTY_ACCOUNT_COST,
9797
};
9898
use std::{sync::Arc, time::Duration};
99-
use tokio::sync::mpsc::{UnboundedReceiver, unbounded_channel};
99+
use tokio::{
100+
sync::mpsc::{UnboundedReceiver, unbounded_channel},
101+
try_join,
102+
};
100103

101104
/// The client version: `anvil/v{major}.{minor}.{patch}`
102105
pub const CLIENT_VERSION: &str = concat!("anvil/v", env!("CARGO_PKG_VERSION"));
@@ -762,12 +765,9 @@ impl EthApi {
762765
block_number: Option<BlockId>,
763766
) -> Result<alloy_rpc_types::eth::AccountInfo> {
764767
node_info!("eth_getAccountInfo");
765-
let account = self
766-
.backend
767-
.get_account_at_block(address, Some(self.block_request(block_number).await?))
768-
.await?;
769-
let code =
770-
self.backend.get_code(address, Some(self.block_request(block_number).await?)).await?;
768+
let account = self.get_account(address, block_number);
769+
let code = self.get_code(address, block_number);
770+
let (account, code) = try_join!(account, code)?;
771771
Ok(alloy_rpc_types::eth::AccountInfo {
772772
balance: account.balance,
773773
nonce: account.nonce,

0 commit comments

Comments
 (0)