diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-02-02 18:24:08 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-02-02 18:24:08 +0200 |
commit | ca2e2c2453f0110f7d32d41abe5029c2e108a0a7 (patch) | |
tree | 2662ab474f117cd5630b3b20a0a46140220f3434 /src/cryptonote_core | |
parent | Merge pull request #1624 (diff) | |
parent | moved get_account_address_from_str_or_url from libcommon to libcryptonote_core (diff) | |
download | monero-ca2e2c2453f0110f7d32d41abe5029c2e108a0a7.tar.xz |
Merge pull request #1627
55a8e982 moved get_account_address_from_str_or_url from libcommon to libcryptonote_core (kenshi84)
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r-- | src/cryptonote_core/cryptonote_basic_impl.cpp | 30 | ||||
-rw-r--r-- | src/cryptonote_core/cryptonote_basic_impl.h | 14 |
2 files changed, 43 insertions, 1 deletions
diff --git a/src/cryptonote_core/cryptonote_basic_impl.cpp b/src/cryptonote_core/cryptonote_basic_impl.cpp index 5a8c61dd9..51c9269a5 100644 --- a/src/cryptonote_core/cryptonote_basic_impl.cpp +++ b/src/cryptonote_core/cryptonote_basic_impl.cpp @@ -41,6 +41,7 @@ using namespace epee; #include "common/base58.h" #include "crypto/hash.h" #include "common/int-util.h" +#include "common/dns_utils.h" #undef MONERO_DEFAULT_LOG_CATEGORY #define MONERO_DEFAULT_LOG_CATEGORY "cn" @@ -291,7 +292,34 @@ namespace cryptonote { crypto::hash8 payment_id; return get_account_integrated_address_from_str(adr, has_payment_id, payment_id, testnet, str); } - + //-------------------------------------------------------------------------------- + bool get_account_address_from_str_or_url( + cryptonote::account_public_address& address + , bool& has_payment_id + , crypto::hash8& payment_id + , bool testnet + , const std::string& str_or_url + ) + { + if (get_account_integrated_address_from_str(address, has_payment_id, payment_id, testnet, str_or_url)) + return true; + bool dnssec_valid; + std::string address_str = tools::dns_utils::get_account_address_as_str_from_url(str_or_url, dnssec_valid); + return !address_str.empty() && + get_account_integrated_address_from_str(address, has_payment_id, payment_id, testnet, address_str); + } + //-------------------------------------------------------------------------------- + bool get_account_address_from_str_or_url( + cryptonote::account_public_address& address + , bool testnet + , const std::string& str_or_url + ) + { + bool has_payment_id; + crypto::hash8 payment_id; + return get_account_address_from_str_or_url(address, testnet, str_or_url); + } + //-------------------------------------------------------------------------------- bool operator ==(const cryptonote::transaction& a, const cryptonote::transaction& b) { return cryptonote::get_transaction_hash(a) == cryptonote::get_transaction_hash(b); } diff --git a/src/cryptonote_core/cryptonote_basic_impl.h b/src/cryptonote_core/cryptonote_basic_impl.h index 147bc89ba..5703a7d75 100644 --- a/src/cryptonote_core/cryptonote_basic_impl.h +++ b/src/cryptonote_core/cryptonote_basic_impl.h @@ -100,6 +100,20 @@ namespace cryptonote { , const std::string& str ); + bool get_account_address_from_str_or_url( + cryptonote::account_public_address& address + , bool& has_payment_id + , crypto::hash8& payment_id + , bool testnet + , const std::string& str_or_url + ); + + bool get_account_address_from_str_or_url( + cryptonote::account_public_address& address + , bool testnet + , const std::string& str_or_url + ); + bool is_coinbase(const transaction& tx); bool operator ==(const cryptonote::transaction& a, const cryptonote::transaction& b); |