From f5d82df477e5e28ee935879374a876ade07dca86 Mon Sep 17 00:00:00 2001 From: woodser Date: Wed, 29 Nov 2023 10:28:28 -0500 Subject: [PATCH] hide reserved subaddresses in deposit view --- .../main/java/haveno/core/xmr/model/XmrAddressEntry.java | 7 ++++++- .../haveno/desktop/main/funds/deposit/DepositView.java | 8 +++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/haveno/core/xmr/model/XmrAddressEntry.java b/core/src/main/java/haveno/core/xmr/model/XmrAddressEntry.java index 451981fc..43e007bb 100644 --- a/core/src/main/java/haveno/core/xmr/model/XmrAddressEntry.java +++ b/core/src/main/java/haveno/core/xmr/model/XmrAddressEntry.java @@ -37,12 +37,17 @@ import java.util.Optional; @EqualsAndHashCode @Slf4j public final class XmrAddressEntry implements PersistablePayload { + public enum Context { ARBITRATOR, BASE_ADDRESS, AVAILABLE, OFFER_FUNDING, - TRADE_PAYOUT + TRADE_PAYOUT; + + public boolean isReserved() { + return this == Context.OFFER_FUNDING || this == Context.TRADE_PAYOUT; + } } // keyPair can be null in case the object is created from deserialization as it is transient. diff --git a/desktop/src/main/java/haveno/desktop/main/funds/deposit/DepositView.java b/desktop/src/main/java/haveno/desktop/main/funds/deposit/DepositView.java index 0818aaf5..4ce4b0f8 100644 --- a/desktop/src/main/java/haveno/desktop/main/funds/deposit/DepositView.java +++ b/desktop/src/main/java/haveno/desktop/main/funds/deposit/DepositView.java @@ -320,9 +320,11 @@ public class DepositView extends ActivatableView { observableList.forEach(DepositListItem::cleanup); observableList.clear(); - // add address entries - xmrWalletService.getAddressEntries() - .forEach(e -> observableList.add(new DepositListItem(e, xmrWalletService, formatter, txsWithIncomingOutputs))); + // add non-reserved address entries + for (XmrAddressEntry addressEntry : xmrWalletService.getAddressEntries()) { + if (addressEntry.getContext().isReserved()) continue; + observableList.add(new DepositListItem(addressEntry, xmrWalletService, formatter, txsWithIncomingOutputs)); + } } private Coin getAmount() {