From 0393127d68f59daf19d51fe2d4aa0f421f4dd516 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Tue, 6 Apr 2021 10:22:21 +0200 Subject: [PATCH] USD fiat skip check against exchange API (#337) * Added fiat code check for USD to prevent querying the exchange API unnecessarily * Moved usd check to info provider --- src/providers/info.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/providers/info.rs b/src/providers/info.rs index 1cf1fc610..db41f7048 100644 --- a/src/providers/info.rs +++ b/src/providers/info.rs @@ -244,6 +244,10 @@ impl DefaultInfoProvider<'_> { } pub fn exchange_usd_to(&self, currency_code: &str) -> ApiResult { + if ¤cy_code.to_lowercase() == "usd" { + return Ok(1.0); + } + let currency_code = currency_code.to_uppercase(); let exchange = self.fetch_exchange()?; match exchange.rates {