skip the exchange currencies request in offline mode in the desktop and terminal general settings
What changed, and why it matters
This change stops Sparrow Wallet from trying to fetch live fiat-currency exchange rates when the user has explicitly chosen 'offline mode'. Instead of making a network request that is doomed to fail, it now reuses the currency already saved in settings. It also hides the warning that normally appears when the currency list fails to load, because in offline mode that failure is expected. This is a reliability/usability fix, not a security patch.
No security action required. Treat as a normal bug-fix / UX improvement. If reviewing for release notes, note that offline-mode settings no longer attempt network requests.
Security signals we found
Avoids unnecessary network egress in offline mode
Reduces error/warning noise for expected offline behavior
Evidence from the diff
In both the desktop (GeneralSettingsController) and terminal (GeneralDialog) general settings dialogs, updateCurrencies() now checks Config.get().getMode() == Mode.OFFLINE before instantiating ExchangeSource.CurrenciesService. In offline mode it short-circuits to a list containing only the configured fiat currency (or an empty list if none/ExchangeSource.NONE), avoiding a network call. The currenciesLoadWarning visibility test is also gated with Config.get().getMode() != Mode.OFFLINE so the warning is not shown when offline. No cryptographic, authentication, or input-validation logic is changed.
Changed components
src/main/java/com/sparrowwallet/sparrow/settings/GeneralSettingsController.javasrc/main/java/com/sparrowwallet/sparrow/terminal/settings/GeneralDialog.javaInspect captured patch +15 / −1
### src/main/java/com/sparrowwallet/sparrow/settings/GeneralSettingsController.java
@@ -3,6 +3,7 @@
import com.sparrowwallet.drongo.wallet.Wallet;
import com.sparrowwallet.sparrow.AppServices;
import com.sparrowwallet.sparrow.EventManager;
+import com.sparrowwallet.sparrow.Mode;
import com.sparrowwallet.sparrow.control.TextfieldDialog;
import com.sparrowwallet.sparrow.control.UnlabeledToggleSwitch;
import com.sparrowwallet.sparrow.event.*;
@@ -207,6 +208,12 @@ private ObservableList<Server> getBlockExplorerList() {
}
private void updateCurrencies(ExchangeSource exchangeSource) {
+ if(Config.get().getMode() == Mode.OFFLINE) {
+ Currency configCurrency = Config.get().getFiatCurrency();
+ updateCurrencies(configCurrency == null || exchangeSource == ExchangeSource.NONE ? List.of() : List.of(configCurrency));
+ return;
+ }
+
ExchangeSource.CurrenciesService currenciesService = new ExchangeSource.CurrenciesService(exchangeSource);
currenciesService.setOnSucceeded(event -> {
updateCurrencies(currenciesService.getValue());
@@ -235,7 +242,7 @@ private void updateCurrencies(List<Currency> currencies) {
fiatCurrency.setDisable(true);
}
- currenciesLoadWarning.setVisible(exchangeSource.getValue() != ExchangeSource.NONE && currencies.isEmpty());
+ currenciesLoadWarning.setVisible(exchangeSource.getValue() != ExchangeSource.NONE && currencies.isEmpty() && Config.get().getMode() != Mode.OFFLINE);
//Always fire event regardless of previous selection to update rates
EventManager.get().post(new FiatCurrencySelectedEvent(exchangeSource.getValue(), fiatCurrency.getValue()));
### src/main/java/com/sparrowwallet/sparrow/terminal/settings/GeneralDialog.java
@@ -5,6 +5,7 @@
import com.googlecode.lanterna.gui2.dialogs.DialogWindow;
import com.sparrowwallet.drongo.BitcoinUnit;
import com.sparrowwallet.sparrow.EventManager;
+import com.sparrowwallet.sparrow.Mode;
import com.sparrowwallet.sparrow.UnitFormat;
import com.sparrowwallet.sparrow.event.BitcoinUnitChangedEvent;
import com.sparrowwallet.sparrow.event.FiatCurrencySelectedEvent;
@@ -116,6 +117,12 @@ private void onDone() {
}
private void updateCurrencies(ExchangeSource exchangeSource) {
+ if(Config.get().getMode() == Mode.OFFLINE) {
+ Currency configCurrency = Config.get().getFiatCurrency();
+ updateCurrencies(configCurrency == null || exchangeSource == ExchangeSource.NONE ? List.of() : List.of(configCurrency));
+ return;
+ }
+
Platform.runLater(() -> {
ExchangeSource.CurrenciesService currenciesService = new ExchangeSource.CurrenciesService(exchangeSource);
currenciesService.setOnSucceeded(event -> {Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.