mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-05 05:46:44 +00:00
when hiding empty used addresses, remove updated address nodes where address balance is zero
This commit is contained in:
parent
b0e1f6fe32
commit
d7ce58d810
1 changed files with 6 additions and 1 deletions
|
@ -5,6 +5,7 @@ import com.sparrowwallet.sparrow.AppServices;
|
||||||
import com.sparrowwallet.sparrow.EventManager;
|
import com.sparrowwallet.sparrow.EventManager;
|
||||||
import com.sparrowwallet.sparrow.event.ReceiveActionEvent;
|
import com.sparrowwallet.sparrow.event.ReceiveActionEvent;
|
||||||
import com.sparrowwallet.sparrow.event.ReceiveToEvent;
|
import com.sparrowwallet.sparrow.event.ReceiveToEvent;
|
||||||
|
import com.sparrowwallet.sparrow.io.Config;
|
||||||
import com.sparrowwallet.sparrow.wallet.Entry;
|
import com.sparrowwallet.sparrow.wallet.Entry;
|
||||||
import com.sparrowwallet.sparrow.wallet.NodeEntry;
|
import com.sparrowwallet.sparrow.wallet.NodeEntry;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
@ -106,7 +107,7 @@ public class AddressTreeTable extends CoinTreeTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateHistory(List<WalletNode> updatedNodes) {
|
public void updateHistory(List<WalletNode> updatedNodes) {
|
||||||
//We only ever add child nodes - never remove in order to keep a full sequence
|
//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();
|
NodeEntry rootEntry = (NodeEntry)getRoot().getValue();
|
||||||
|
|
||||||
for(WalletNode updatedNode : updatedNodes) {
|
for(WalletNode updatedNode : updatedNodes) {
|
||||||
|
@ -114,6 +115,10 @@ public class AddressTreeTable extends CoinTreeTable {
|
||||||
if(optEntry.isPresent()) {
|
if(optEntry.isPresent()) {
|
||||||
NodeEntry existingEntry = (NodeEntry)optEntry.get();
|
NodeEntry existingEntry = (NodeEntry)optEntry.get();
|
||||||
existingEntry.refreshChildren();
|
existingEntry.refreshChildren();
|
||||||
|
|
||||||
|
if(Config.get().isHideEmptyUsedAddresses() && existingEntry.getValue() == 0L) {
|
||||||
|
rootEntry.getChildren().remove(existingEntry);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
NodeEntry nodeEntry = new NodeEntry(rootEntry.getWallet(), updatedNode);
|
NodeEntry nodeEntry = new NodeEntry(rootEntry.getWallet(), updatedNode);
|
||||||
rootEntry.getChildren().add(nodeEntry);
|
rootEntry.getChildren().add(nodeEntry);
|
||||||
|
|
Loading…
Reference in a new issue