Merge pull request #4948

1d892ec simplewallet: donate command validate amount (selsta)
This commit is contained in:
luigi1111 2018-12-31 16:10:30 -06:00
commit a872a2a41a
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010
1 changed files with 12 additions and 2 deletions

View File

@ -6348,8 +6348,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
uint64_t amount;
bool ok = cryptonote::parse_amount(amount, local_args.back());
if (ok && amount != 0)
{
amount_str = local_args.back(); amount_str = local_args.back();
local_args.pop_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
std::string address_str; std::string address_str;
if (m_wallet->nettype() != cryptonote::MAINNET) if (m_wallet->nettype() != cryptonote::MAINNET)