fix: parse fee rate with the invariant culture

On Italian/German systems "1.5" was read as 15 sat/vB. The Send form,
the Donate form and the CLI now share CoinAmount.TryParseFeeRate
(invariant culture, '.' or ',' as decimal separator, range (0, 1000]).
Donate and the CLI report an invalid rate instead of silently using 1.
This commit is contained in:
davide committed 2026-11-03 12:15:27 +01:00
1 parent d431996ddc
commit cb551efce4
7 files changed
+99 -7

No files matched your search

+3 -1
View File
@@ -217,7 +217,9 @@ static async Task<int> Send(string[] o)
long amount = 0;
if (!sendAll && !CoinAmount.TryParseCoins(Opt(o, "--amount") ?? "", out amount))
throw new WalletSpendException("--amount missing or invalid (or use --all).");
var feeRate = decimal.TryParse(Opt(o, "--feerate"), out var fr) ? fr : 1m;
var feeRate = 1m;
if (Opt(o, "--feerate") is { } feeText && !CoinAmount.TryParseFeeRate(feeText, out feeRate))
throw new WalletSpendException($"--feerate invalid (expected sat/vB in (0, {CoinAmount.MaxFeeRate}]).");
// Source transactions of the UTXOs: needed for amounts and signing.
await using var client = await Connect(o, account.Profile);