Skip to content

Commit

Permalink
fix: block net_version on a separate runtime (#602)
Browse files Browse the repository at this point in the history
  • Loading branch information
itegulov authored Feb 28, 2025
1 parent 5defcfe commit 8ca721d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crates/api_server/src/impls/net.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::error::RpcError;
use anvil_zksync_api_decl::NetNamespaceServer;
use anvil_zksync_core::node::InMemoryNode;
use anvil_zksync_core::utils::block_on;
use jsonrpsee::core::RpcResult;
use zksync_types::U256;

Expand All @@ -17,8 +18,8 @@ impl NetNamespace {
// TODO: Make this namespace async in zksync-era
impl NetNamespaceServer for NetNamespace {
fn version(&self) -> RpcResult<String> {
let chain_id = tokio::runtime::Handle::current()
.block_on(async { self.node.get_chain_id().await.map_err(RpcError::from) })?;
let node = self.node.clone();
let chain_id = block_on(async move { node.get_chain_id().await.map_err(RpcError::from) })?;
Ok(chain_id.to_string())
}

Expand Down

0 comments on commit 8ca721d

Please sign in to comment.