mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
simplewallet: donate command validate amount
This commit is contained in:
parent
7e957c162a
commit
1d892ec881
@ -5970,8 +5970,18 @@ bool simple_wallet::donate(const std::vector<std::string> &args_)
|
|||||||
local_args.pop_back();
|
local_args.pop_back();
|
||||||
}
|
}
|
||||||
// get amount and pop
|
// get amount and pop
|
||||||
amount_str = local_args.back();
|
uint64_t amount;
|
||||||
local_args.pop_back();
|
bool ok = cryptonote::parse_amount(amount, local_args.back());
|
||||||
|
if (ok && amount != 0)
|
||||||
|
{
|
||||||
|
amount_str = local_args.back();
|
||||||
|
local_args.pop_back();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fail_msg_writer() << tr("amount is wrong: ") << local_args.back() << ", " << tr("expected number from 0 to ") << print_money(std::numeric_limits<uint64_t>::max());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// push back address, amount, payment id
|
// push back address, amount, payment id
|
||||||
local_args.push_back(MONERO_DONATION_ADDR);
|
local_args.push_back(MONERO_DONATION_ADDR);
|
||||||
local_args.push_back(amount_str);
|
local_args.push_back(amount_str);
|
||||||
|
Loading…
Reference in New Issue
Block a user