fix(ui): validate shielded addresses with the correct RPC

The Validate address dialog chose its RPC from the first character of
the input, then asked the transparent-only validateaddress for every
case. That RPC is Base58-only, so a valid Sapling (z) address came back
isvalid=false and was reported invalid.

- The input is now classified with the checksum-verified recognizers,
  and a shielded address is sent to z_validateaddress while a
  transparent (mining) address keeps validateaddress.
- Anything that is not an address - a typo, garbage, or a pasted
  viewing/spending key - is judged invalid on the spot and never sent to
  the node, so a key pasted into the field is not leaked to an RPC.
- On Lite there is no node to ask, so the dialog shows the checksum
  verdict alone and hides the "owned by this wallet" row.

Tests: validateRpcMethod maps shielded to z_validateaddress, transparent
to validateaddress, and a key or empty string to no RPC.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 21:42:23 -05:00
co-authored by Claude Opus 4.8
parent abc82136c4
commit 579accd0c6
5 changed files with 88 additions and 64 deletions
+6
View File
@@ -58,5 +58,11 @@ bool isValidRecipientAddress(const std::string& s);
enum class RecipientKind { Invalid, Shielded, MiningOnly };
RecipientKind classifyRecipient(const std::string& s);
// The daemon RPC that can validate an address of this kind: "z_validateaddress" for a shielded (Sapling)
// address, "validateaddress" for a transparent one (z_validateaddress reports isvalid=false for those, and
// validateaddress is Base58-only so it reports false for Sapling), nullptr for Invalid (not an address:
// answer client-side, send nothing to the node).
const char* validateRpcMethod(RecipientKind kind);
} // namespace util
} // namespace dragonx