enamble nullable types
MODIFY
WalletWasabi.Backend/Controllers/OffchainController.cs
WalletWasabi.Backend/Controllers/OffchainController.cs
@@ -56,16 +56,15 @@ namespace WalletWasabi.Backend.Controllers
{
exchangeRates = await ExchangeRateProvider.GetExchangeRateAsync();
- if (exchangeRates is null)
+ if (exchangeRates.Any())
{
- return Enumerable.Empty<ExchangeRate>();
- }
-
var cacheEntryOptions = new MemoryCacheEntryOptions()
.SetAbsoluteExpiration(TimeSpan.FromSeconds(500));
Cache.Set(cacheKey, exchangeRates, cacheEntryOptions);
}
+
+ }
return exchangeRates;
}
}

MODIFY
WalletWasabi/WebClients/CoinGecko/CoinGeckoExchangeRate.cs
WalletWasabi/WebClients/CoinGecko/CoinGeckoExchangeRate.cs
+#nullable enable
+
using Newtonsoft.Json;
namespace WalletWasabi.WebClients.CoinGecko

MODIFY
WalletWasabi/WebClients/Coinstamp/CoinstampExchangeRate.cs
WalletWasabi/WebClients/Coinstamp/CoinstampExchangeRate.cs
+#nullable enable
+
using Newtonsoft.Json;
namespace WalletWasabi.WebClients.Coinstamp

MODIFY
WalletWasabi/WebClients/ExchangeRateProviders.cs
WalletWasabi/WebClients/ExchangeRateProviders.cs
+#nullable enable
+
using NBitcoin;
using System;
using System.Collections.Generic;
@@ -12,6 +14,7 @@ using WalletWasabi.WebClients.CoinGecko;
using WalletWasabi.WebClients.Gemini;
using WalletWasabi.WebClients.ItBit;
using WalletWasabi.WebClients.SmartBit;
+using System.Linq;
namespace WalletWasabi.WebClients
{
@@ -30,14 +33,11 @@ namespace WalletWasabi.WebClients
public async Task<List<ExchangeRate>> GetExchangeRateAsync()
{
- List<ExchangeRate> exchangeRates = null;
-
foreach (var provider in ExchangeRateProviders)
{
try
{
- exchangeRates = await provider.GetExchangeRateAsync();
- break;
+ return await provider.GetExchangeRateAsync();
}
catch (Exception ex)
{
@@ -45,7 +45,7 @@ namespace WalletWasabi.WebClients
Logger.LogTrace(ex);
}
}
- return exchangeRates;
+ return Enumerable.Empty<ExchangeRate>().ToList();
}
}
}

enamble nullable types