fix incorrect script type selected in settings on p2tr wallet load
What changed, and why it matters
This commit fixes a UI bug in Sparrow Wallet's settings screen. When loading a wallet that uses Taproot (P2TR), the settings dialog was incorrectly showing the default script type rather than the wallet's actual script type. The fix moves the default-selection logic so it only runs during initial setup, not when an existing wallet is being loaded. There is no direct evidence this is a security vulnerability.
Treat as a routine bug fix. No urgent security action required. Users relying on the settings screen to verify wallet type should update to the fixed version to avoid confusion.
Security signals we found
UI state desynchronization between displayed and actual wallet script type
Potential user confusion about wallet configuration
No evidence of funds loss, key leakage, or transaction manipulation
Evidence from the diff
In SettingsController.java, the code previously called scriptType.getSelectionModel().select(policyType.getDefaultScriptType()) unconditionally after setting policy type. This caused the script type dropdown to be reset to the default whenever a wallet was loaded, even for existing P2TR wallets. The change moves that selection inside the if(!initialising) block, so it only applies when the user is changing policy type interactively, not during initial wallet load. This is a UI state bug, not a cryptographic or protocol flaw.
Changed components
src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.javaWallet settings UI script type selectionInspect captured patch +1 / −2
diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java
index 659aced..bc95ee9 100644
--- a/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java
+++ b/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java
@@ -125,9 +125,8 @@ public class SettingsController extends WalletFormController implements Initiali
walletForm.getWallet().setPolicyType(policyType);
scriptType.setItems(FXCollections.observableArrayList(ScriptType.getAddressableScriptTypes(policyType)));
- scriptType.getSelectionModel().select(policyType.getDefaultScriptType());
-
if(!initialising) {
+ scriptType.getSelectionModel().select(policyType.getDefaultScriptType());
clearKeystoreTabs();
}
initialising = false;
Why this scored 17/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.