switch wallet tables and charts to btc when an open wallet on the auto unit receives 1 btc or more
What changed, and why it matters
This commit changes how Sparrow Wallet displays bitcoin amounts in tables and charts. When a wallet using the 'auto' unit setting receives 1 BTC or more, the app now switches the display from satoshis to BTC. This is a user-interface convenience change, not a security fix.
No security action needed. Review as a normal UI/UX change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch moves calls to setUnitFormat() from initialization methods into update/updateHistory methods across five UI components (AddressTreeTable, BalanceChart, TransactionsTreeTable, UtxosChart, UtxosTreeTable). This ensures the display unit is recalculated dynamically whenever wallet history changes, so that wallets on the ‘auto’ unit setting can switch to BTC once any balance reaches or exceeds 1 BTC. There are no cryptographic, network, or access-control changes.
Changed components
AddressTreeTable UI componentBalanceChart UI componentTransactionsTreeTable UI componentUtxosChart UI componentUtxosTreeTable UI componentInspect captured patch +8 / −4
### src/main/java/com/sparrowwallet/sparrow/control/AddressTreeTable.java
@@ -135,6 +135,7 @@ public void updateAll(NodeEntry rootEntry) {
public void updateHistory(List<WalletNode> updatedNodes) {
//We only ever add child nodes - never remove in order to keep a full sequence (unless hide empty used addresses is set)
NodeEntry rootEntry = (NodeEntry)getRoot().getValue();
+ setUnitFormat(rootEntry.getWallet());
Map<WalletNode, NodeEntry> childNodes = new HashMap<>();
for(Entry childEntry : rootEntry.getChildren()) {
### src/main/java/com/sparrowwallet/sparrow/control/BalanceChart.java
@@ -35,11 +35,10 @@ public void initialize(WalletTransactionsEntry walletTransactionsEntry) {
balanceSeries = new XYChart.Series<>();
getData().add(balanceSeries);
update(walletTransactionsEntry);
-
- setUnitFormat(walletTransactionsEntry.getWallet(), Config.get().getUnitFormat(), Config.get().getBitcoinUnit());
}
public void update(WalletTransactionsEntry walletTransactionsEntry) {
+ setUnitFormat(walletTransactionsEntry.getWallet(), Config.get().getUnitFormat(), Config.get().getBitcoinUnit());
setVisible(!walletTransactionsEntry.getChildren().isEmpty());
balanceSeries.getData().clear();
### src/main/java/com/sparrowwallet/sparrow/control/TransactionsTreeTable.java
@@ -64,6 +64,8 @@ public void updateAll(WalletTransactionsEntry rootEntry) {
}
public void updateHistory() {
+ setUnitFormat(getRoot().getValue().getWallet());
+
//Transaction entries should have already been updated using WalletTransactionsEntry.updateHistory, so only a resort required
sort();
resetSortColumn();
### src/main/java/com/sparrowwallet/sparrow/control/UtxosChart.java
@@ -36,11 +36,11 @@ public void initialize(WalletUtxosEntry walletUtxosEntry) {
utxoSeries = new XYChart.Series<>();
getData().add(utxoSeries);
update(walletUtxosEntry);
-
- setUnitFormat(walletUtxosEntry.getWallet(), Config.get().getUnitFormat(), Config.get().getBitcoinUnit());
}
public void update(WalletUtxosEntry walletUtxosEntry) {
+ setUnitFormat(walletUtxosEntry.getWallet(), Config.get().getUnitFormat(), Config.get().getBitcoinUnit());
+
List<Data<String, Number>> utxoDataList = walletUtxosEntry.getChildren().stream()
.map(entry -> new XYChart.Data<>(getCategoryName(entry), (Number)entry.getValue(), entry))
.sorted((o1, o2) -> Long.compare(o2.getYValue().longValue(), o1.getYValue().longValue()))
### src/main/java/com/sparrowwallet/sparrow/control/UtxosTreeTable.java
@@ -103,6 +103,8 @@ public void updateAll(WalletUtxosEntry rootEntry) {
}
public void updateHistory() {
+ setUnitFormat(getRoot().getValue().getWallet());
+
//Utxo entries should have already been updated, so only a resort required
if(!getRoot().getChildren().isEmpty()) {
sort();Why this scored 15/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.