Merge pull request #3057

9ffa97fe Factor the monero donation address (Maxithi)
This commit is contained in:
Riccardo Spagni 2018-01-25 16:46:18 -08:00
commit ede4e1c54c
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
3 changed files with 6 additions and 5 deletions

View file

@ -4557,8 +4557,6 @@ bool simple_wallet::donate(const std::vector<std::string> &args_)
fail_msg_writer() << tr("usage: donate [index=<N1>[,<N2>,...]] [<priority>] [<ring_size>] <amount> [<payment_id>]"); fail_msg_writer() << tr("usage: donate [index=<N1>[,<N2>,...]] [<priority>] [<ring_size>] <amount> [<payment_id>]");
return true; return true;
} }
// Hardcode Monero's donation address (see #1447)
const std::string address_str = "44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A";
std::string amount_str; std::string amount_str;
std::string payment_id_str; std::string payment_id_str;
// get payment id and pop // get payment id and pop
@ -4574,11 +4572,11 @@ bool simple_wallet::donate(const std::vector<std::string> &args_)
amount_str = local_args.back(); amount_str = local_args.back();
local_args.pop_back(); local_args.pop_back();
// push back address, amount, payment id // push back address, amount, payment id
local_args.push_back(address_str); local_args.push_back(MONERO_DONATION_ADDR);
local_args.push_back(amount_str); local_args.push_back(amount_str);
if (!payment_id_str.empty()) if (!payment_id_str.empty())
local_args.push_back(payment_id_str); local_args.push_back(payment_id_str);
message_writer() << tr("Donating ") << amount_str << " to The Monero Project (donate.getmonero.org/44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A)."; message_writer() << tr("Donating ") << amount_str << " to The Monero Project (donate.getmonero.org/"<< MONERO_DONATION_ADDR <<").";
transfer_new(local_args); transfer_new(local_args);
return true; return true;
} }

View file

@ -49,6 +49,8 @@
#undef MONERO_DEFAULT_LOG_CATEGORY #undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "wallet.simplewallet" #define MONERO_DEFAULT_LOG_CATEGORY "wallet.simplewallet"
// Hardcode Monero's donation address (see #1447)
constexpr const char MONERO_DONATION_ADDR[] = "44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A";
/*! /*!
* \namespace cryptonote * \namespace cryptonote

View file

@ -32,6 +32,7 @@
#include "wallet/wallet2.h" #include "wallet/wallet2.h"
#include "common/dns_utils.h" #include "common/dns_utils.h"
#include "simplewallet/simplewallet.h"
#include <string> #include <string>
TEST(AddressFromTXT, Success) TEST(AddressFromTXT, Success)
@ -83,7 +84,7 @@ TEST(AddressFromTXT, Failure)
TEST(AddressFromURL, Success) TEST(AddressFromURL, Success)
{ {
const std::string addr = "44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A"; const std::string addr = MONERO_DONATION_ADDR;
bool dnssec_result = false; bool dnssec_result = false;