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])) }