keep the entered address for a payment when showing its cached payment instruction name in the send tab and send to many
What changed, and why it matters
This commit fixes a user-interface bug in the Sparrow Bitcoin wallet where a saved payment recipient could lose its actual Bitcoin address when reloaded. Previously, if a payment had a human-readable name (like an email-style payment alias) cached, the wallet would display only that name and discard the underlying address. The fix keeps both the name and the address, so the wallet sends funds to the correct destination instead of potentially resolving the name again to a different or stale address. There is no direct evidence this was exploited or treated as a security vulnerability by the project.
Treat as a correctness fix worth including in the next release. Users relying on saved payment aliases or silent-payment recipients should upgrade. Reviewers may want to verify that the cached HRN cannot be confused with a manually entered address and that DNS re-resolution is fully skipped when an address is present.
Security signals we found
Address-destination mismatch risk from re-resolving a cached human-readable name
Silent payment address handling added alongside legacy addresses
UI field now preserves underlying recipient while displaying alias
No explicit security language in commit message or diff
Evidence from the diff
The patch changes how cached DNS payment instructions (human-readable names, HRNs) are displayed and converted back to payments. In PaymentController and SendToDialog, a payment loaded from storage that has both a cached HRN and an actual address/silent-payment-address now retains the address fields. The toPayment() path only resolves the HRN if no address is already present, preventing a re-resolution that could return a different result. The UI now shows the HRN in the address field while keeping the real recipient internally. This closes a logic gap where the address was dropped during serialization/deserialization round-trips.
Changed components
src/main/java/com/sparrowwallet/sparrow/control/SendToManyDialog.javasrc/main/java/com/sparrowwallet/sparrow/wallet/PaymentController.javadrongo submoduleInspect captured patch +20 / −9
### drongo
@@ -1 +1 @@
-Subproject commit d81ff1a5c370e31dd8e205d6a4e3c9778c4111b3
+Subproject commit 57e879dff3569dc4e8fd68e7a4efd088528b05b6
### src/main/java/com/sparrowwallet/sparrow/control/SendToManyDialog.java
@@ -220,7 +220,7 @@ private boolean needsResolution() {
for(int row = 0; row < spreadsheetView.getGrid().getRowCount(); row++) {
ObservableList<SpreadsheetCell> rowCells = spreadsheetView.getItems().get(row);
SendToAddress sendToAddress = (SendToAddress)rowCells.getFirst().getItem();
- if(sendToAddress != null && sendToAddress.hrn != null && DnsPaymentCache.getDnsPayment(sendToAddress.hrn) == null) {
+ if(sendToAddress != null && sendToAddress.hrn != null && sendToAddress.address == null && sendToAddress.silentPaymentAddress == null && DnsPaymentCache.getDnsPayment(sendToAddress.hrn) == null) {
return true;
}
}
@@ -577,6 +577,12 @@ public SendToAddress(String hrn) {
this.silentPaymentAddress = null;
}
+ private SendToAddress(String hrn, Address address, SilentPaymentAddress silentPaymentAddress) {
+ this.hrn = hrn;
+ this.address = address;
+ this.silentPaymentAddress = silentPaymentAddress;
+ }
+
public SendToAddress(Address address) {
this.hrn = null;
this.address = address;
@@ -595,14 +601,15 @@ public String toString() {
public static SendToAddress fromPayment(Payment payment) {
DnsPayment dnsPayment = DnsPaymentCache.getDnsPayment(payment);
- if(dnsPayment != null) {
- return new SendToAddress(dnsPayment.hrn());
+ if(payment instanceof SilentPayment silentPayment) {
+ return new SendToAddress(dnsPayment == null ? null : dnsPayment.hrn(), null, silentPayment.getSilentPaymentAddress());
}
- return payment instanceof SilentPayment ? new SendToAddress(((SilentPayment)payment).getSilentPaymentAddress()) : new SendToAddress(payment.getAddress());
+ return new SendToAddress(dnsPayment == null ? null : dnsPayment.hrn(), payment.getAddress(), null);
}
public Payment toPayment(Wallet wallet, String label, long value, boolean sendMax) throws DnsPaymentValidationException, IOException, ExecutionException, InterruptedException, BitcoinURIParseException {
- if(hrn != null) {
+ //A name shown for a payment's own recipient is not resolved again
+ if(hrn != null && address == null && silentPaymentAddress == null) {
DnsPayment dnsPayment = DnsPaymentCache.getDnsPayment(hrn);
if(dnsPayment == null) {
DnsPaymentResolver resolver = new DnsPaymentResolver(hrn);
### src/main/java/com/sparrowwallet/sparrow/wallet/PaymentController.java
@@ -177,15 +177,16 @@ public void changed(ObservableValue<? extends String> observable, String oldValu
dnsPaymentProperty.set(null);
}
- if(silentPaymentAddressProperty.get() != null && !newValue.equals(silentPaymentAddressProperty.get().getAddress())) {
+ if(silentPaymentAddressProperty.get() != null && !newValue.equals(silentPaymentAddressProperty.get().getAddress()) && dnsPaymentProperty.get() == null) {
silentPaymentAddressProperty.set(null);
}
if(payjoinURIProperty.get() != null && !newValue.equals(payjoinURIProperty.get().getAddress().toString())) {
payjoinURIProperty.set(null);
}
- if(payNymProperty.get() == null) {
+ //A name already resolved is shown in place of its recipient, which is not parsed again from it
+ if(payNymProperty.get() == null && dnsPaymentProperty.get() == null) {
try {
BitcoinURI bitcoinURI = new BitcoinURI(newValue);
Platform.runLater(() -> updateFromURI(bitcoinURI));
@@ -745,8 +746,11 @@ public void setPayment(Payment payment) {
if(getRecipientValueSats() == null || payment.getAmount() != getRecipientValueSats()) {
if(payment.getAddress() != null) {
DnsPayment dnsPayment = DnsPaymentCache.getDnsPayment(payment);
- if(dnsPayment != null) {
+ if(dnsPayment != null && (!(payment instanceof SilentPayment) || sendController.getWalletForm().getWallet().canSendSilentPayments())) {
+ dnsPaymentProperty.set(dnsPayment);
+ silentPaymentAddressProperty.set(payment instanceof SilentPayment silentPayment ? silentPayment.getSilentPaymentAddress() : null);
address.setText(dnsPayment.hrn());
+ address.leftProperty().set(getBitcoinCharacter());
} else if(payment instanceof SilentPayment silentPayment) {
address.setText(silentPayment.getSilentPaymentAddress().getAddress());
} else {Why this scored 35/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.