fix: Tier-2 mediums — input trims, confirmations, amount normalization

More robustness fixes from the audit (the import-key pattern, lower severity):

- Trim pasted input before use/validation: network add-server URL/label,
  lite-wallet key import (+ block empty), validate-address, address-book entry.
- Confirmations for destructive/irreversible actions:
  - Address-book Delete now needs a confirming second click (no undo).
  - Console `stop` needs a confirming second `stop` (it shuts down the node).
  - Wizard "Skip" encryption needs a confirming second click (keys stored
    unencrypted).
- Send amount: normalize to 8dp (satoshi precision) on both the DRGX and USD
  inputs so digits past 8dp aren't silently dropped between the preview/review
  and what's actually sent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-05 13:18:57 -05:00
parent 129a8e6449
commit 65bb98cd09
7 changed files with 75 additions and 20 deletions

View File

@@ -80,7 +80,10 @@ void ValidateAddressDialog::render(App* app)
s_error_message.clear();
std::string address(s_address_input);
// Trim whitespace/newlines a pasted address often carries (the daemon would reject it).
while (!address.empty() && (address.front()==' '||address.front()=='\t'||address.front()=='\n'||address.front()=='\r')) address.erase(address.begin());
while (!address.empty() && (address.back()==' '||address.back()=='\t'||address.back()=='\n'||address.back()=='\r')) address.pop_back();
// Determine if z-address or t-address
bool is_zaddr = !address.empty() && address[0] == 'z';