From ef5a6a216f0662d1a9486c8a5260216c61bac80b Mon Sep 17 00:00:00 2001 From: Noah Citron Date: Sun, 12 Feb 2023 12:16:11 -0500 Subject: [PATCH] fix: correct zero hex formatting (#195) * fix: correct zero hex formatting * clippy --- client/src/rpc.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/src/rpc.rs b/client/src/rpc.rs index 392e547..2603715 100644 --- a/client/src/rpc.rs +++ b/client/src/rpc.rs @@ -342,5 +342,11 @@ fn format_hex(num: &U256) -> String { .trim_start_matches('0') .to_string(); + let stripped = if stripped.is_empty() { + "0".to_string() + } else { + stripped + }; + format!("0x{stripped}") }