Skip to content

Commit

Permalink
Merge pull request #4948
Browse files Browse the repository at this point in the history
1d892ec simplewallet: donate command validate amount (selsta)
  • Loading branch information
luigi1111 committed Dec 31, 2018
2 parents 69e8567 + 1d892ec commit a872a2a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/simplewallet/simplewallet.cpp
Expand Up @@ -6348,8 +6348,18 @@ bool simple_wallet::donate(const std::vector<std::string> &args_)
local_args.pop_back();
}
// get amount and pop
amount_str = local_args.back();
local_args.pop_back();
uint64_t amount;
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
std::string address_str;
if (m_wallet->nettype() != cryptonote::MAINNET)
Expand Down

0 comments on commit a872a2a

Please sign in to comment.