From 6fa509d152eb81ad578af9da958407474951b0d8 Mon Sep 17 00:00:00 2001 From: incrypto32 Date: Mon, 11 Mar 2024 13:27:54 +0530 Subject: [PATCH] Accept block hashes for eth_getCode --- src/api/eth.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/eth.rs b/src/api/eth.rs index 5c3f22ae..1f2429da 100644 --- a/src/api/eth.rs +++ b/src/api/eth.rs @@ -175,9 +175,9 @@ impl Eth { } /// Get code under given address - pub fn code(&self, address: Address, block: Option) -> CallFuture { + pub fn code(&self, address: Address, block: Option) -> CallFuture { let address = helpers::serialize(&address); - let block = helpers::serialize(&block.unwrap_or(BlockNumber::Latest)); + let block = helpers::serialize(&block.unwrap_or_else(|| BlockNumber::Latest.into())); CallFuture::new(self.transport.execute("eth_getCode", vec![address, block])) }