From 9ffa97fe982fa14cbceaf2a88049f30237a96eb9 Mon Sep 17 00:00:00 2001 From: Maxithi <34792056+Maxithi@users.noreply.github.com> Date: Thu, 4 Jan 2018 15:33:20 +0100 Subject: [PATCH] Factor the monero donation address Signed-off-by: Maxithi <34792056+Maxithi@users.noreply.github.com> --- src/simplewallet/simplewallet.cpp | 6 ++---- src/simplewallet/simplewallet.h | 2 ++ tests/unit_tests/address_from_url.cpp | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index f4f24ed77..f6265da18 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -4534,8 +4534,6 @@ bool simple_wallet::donate(const std::vector &args_) fail_msg_writer() << tr("usage: donate [index=[,,...]] [] [] []"); return true; } - // Hardcode Monero's donation address (see #1447) - const std::string address_str = "44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A"; std::string amount_str; std::string payment_id_str; // get payment id and pop @@ -4551,11 +4549,11 @@ bool simple_wallet::donate(const std::vector &args_) amount_str = local_args.back(); local_args.pop_back(); // 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); if (!payment_id_str.empty()) 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); return true; } diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h index 024077ca1..8bcdcba88 100644 --- a/src/simplewallet/simplewallet.h +++ b/src/simplewallet/simplewallet.h @@ -49,6 +49,8 @@ #undef MONERO_DEFAULT_LOG_CATEGORY #define MONERO_DEFAULT_LOG_CATEGORY "wallet.simplewallet" +// Hardcode Monero's donation address (see #1447) +constexpr const char MONERO_DONATION_ADDR[] = "44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A"; /*! * \namespace cryptonote diff --git a/tests/unit_tests/address_from_url.cpp b/tests/unit_tests/address_from_url.cpp index 3630b59d3..f4ecbc295 100644 --- a/tests/unit_tests/address_from_url.cpp +++ b/tests/unit_tests/address_from_url.cpp @@ -32,6 +32,7 @@ #include "wallet/wallet2.h" #include "common/dns_utils.h" +#include "simplewallet/simplewallet.h" #include TEST(AddressFromTXT, Success) @@ -83,7 +84,7 @@ TEST(AddressFromTXT, Failure) TEST(AddressFromURL, Success) { - const std::string addr = "44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A"; + const std::string addr = MONERO_DONATION_ADDR; bool dnssec_result = false;