mirror of
https://github.com/wownero/wownero.git
synced 2026-10-17 15:41:44 +02:00
simplewallet: reject donations when not on mainnet
This commit is contained in:
@@ -7427,28 +7427,14 @@ bool simple_wallet::donate(const std::vector<std::string> &args_)
|
||||
return true;
|
||||
}
|
||||
// push back address, amount
|
||||
std::string address_str;
|
||||
if (m_wallet->nettype() != cryptonote::MAINNET)
|
||||
{
|
||||
// if not mainnet, convert donation address string to the relevant network type
|
||||
address_parse_info info;
|
||||
if (!cryptonote::get_account_address_from_str(info, cryptonote::MAINNET, MONERO_DONATION_ADDR))
|
||||
{
|
||||
fail_msg_writer() << tr("Failed to parse donation address: ") << MONERO_DONATION_ADDR;
|
||||
return true;
|
||||
}
|
||||
address_str = cryptonote::get_account_address_as_str(m_wallet->nettype(), info.is_subaddress, info.address);
|
||||
fail_msg_writer() << tr("Donations are supported on mainnet only.");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
address_str = MONERO_DONATION_ADDR;
|
||||
}
|
||||
local_args.push_back(address_str);
|
||||
local_args.push_back(MONERO_DONATION_ADDR);
|
||||
local_args.push_back(amount_str);
|
||||
if (m_wallet->nettype() == cryptonote::MAINNET)
|
||||
message_writer() << (boost::format(tr("Donating %s %s to The Monero Project (donate.getmonero.org or %s).")) % amount_str % cryptonote::get_unit(cryptonote::get_default_decimal_point()) % MONERO_DONATION_ADDR).str();
|
||||
else
|
||||
message_writer() << (boost::format(tr("Donating %s %s to %s.")) % amount_str % cryptonote::get_unit(cryptonote::get_default_decimal_point()) % address_str).str();
|
||||
message_writer() << (boost::format(tr("Donating %s %s to The Monero Project (donate.getmonero.org or %s).")) % amount_str % cryptonote::get_unit(cryptonote::get_default_decimal_point()) % MONERO_DONATION_ADDR).str();
|
||||
transfer(local_args);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user