From 2d3bf0b2fe3ca6ee2131c21d7163d13174b8a387 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Thu, 16 Jan 2025 12:18:12 +0200 Subject: [PATCH] skip labelled addresses when retrieving an unused address from the receive tab and send tab pay to wallet --- .../com/sparrowwallet/sparrow/wallet/PaymentController.java | 2 +- .../com/sparrowwallet/sparrow/wallet/ReceiveController.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/PaymentController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/PaymentController.java index ca0729ba..424556fd 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/PaymentController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/PaymentController.java @@ -177,7 +177,7 @@ public class PaymentController extends WalletFormController implements Initializ List
existingAddresses = getOtherAddresses(); WalletNode freshNode = newValue.getFreshNode(KeyPurpose.RECEIVE); Address freshAddress = freshNode.getAddress(); - while(existingAddresses.contains(freshAddress)) { + while(existingAddresses.contains(freshAddress) || (freshNode.getLabel() != null && !freshNode.getLabel().isEmpty())) { freshNode = newValue.getFreshNode(KeyPurpose.RECEIVE, freshNode); freshAddress = freshNode.getAddress(); } diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/ReceiveController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/ReceiveController.java index 5cf9e38d..6003d1f1 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/ReceiveController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/ReceiveController.java @@ -199,6 +199,9 @@ public class ReceiveController extends WalletFormController implements Initializ public void refreshAddress() { NodeEntry freshEntry = getWalletForm().getFreshNodeEntry(KeyPurpose.RECEIVE, currentEntry); + while(freshEntry.getLabel() != null && !freshEntry.getLabel().isEmpty()) { + freshEntry = getWalletForm().getFreshNodeEntry(KeyPurpose.RECEIVE, freshEntry); + } setNodeEntry(freshEntry); if(addressQrDialog != null) { addressQrDialog.close();