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:
@@ -198,5 +198,15 @@ RecipientKind classifyRecipient(const std::string& s)
|
||||
return RecipientKind::Invalid;
|
||||
}
|
||||
|
||||
const char* validateRpcMethod(RecipientKind kind)
|
||||
{
|
||||
switch (kind) {
|
||||
case RecipientKind::Shielded: return "z_validateaddress";
|
||||
case RecipientKind::MiningOnly: return "validateaddress";
|
||||
case RecipientKind::Invalid: break;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
} // namespace dragonx
|
||||
|
||||
Reference in New Issue
Block a user