diff options
author | kenshi84 <kenshi84@protonmail.ch> | 2017-02-19 11:42:10 +0900 |
---|---|---|
committer | kenshi84 <kenshi84@protonmail.ch> | 2017-10-07 13:06:21 +0900 |
commit | 53ad5a0f42174bca57e24485ef3d40e4b9cf5599 (patch) | |
tree | afc13a3ee6a049ec78ac234e2d55ff46e992b457 /src/cryptonote_basic/cryptonote_basic.h | |
parent | Merge pull request #2548 (diff) | |
download | monero-53ad5a0f42174bca57e24485ef3d40e4b9cf5599.tar.xz |
Subaddresses
Diffstat (limited to 'src/cryptonote_basic/cryptonote_basic.h')
-rw-r--r-- | src/cryptonote_basic/cryptonote_basic.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/cryptonote_basic/cryptonote_basic.h b/src/cryptonote_basic/cryptonote_basic.h index eb03d33b9..89dda8c3d 100644 --- a/src/cryptonote_basic/cryptonote_basic.h +++ b/src/cryptonote_basic/cryptonote_basic.h @@ -411,6 +411,17 @@ namespace cryptonote KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(m_spend_public_key) KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(m_view_public_key) END_KV_SERIALIZE_MAP() + + bool operator==(const account_public_address& rhs) const + { + return m_spend_public_key == rhs.m_spend_public_key && + m_view_public_key == rhs.m_view_public_key; + } + + bool operator!=(const account_public_address& rhs) const + { + return !(*this == rhs); + } }; struct keypair @@ -429,6 +440,21 @@ namespace cryptonote } +namespace std { + template <> + struct hash<cryptonote::account_public_address> + { + std::size_t operator()(const cryptonote::account_public_address& addr) const + { + // https://stackoverflow.com/a/17017281 + size_t res = 17; + res = res * 31 + hash<crypto::public_key>()(addr.m_spend_public_key); + res = res * 31 + hash<crypto::public_key>()(addr.m_view_public_key); + return res; + } + }; +} + BLOB_SERIALIZER(cryptonote::txout_to_key); BLOB_SERIALIZER(cryptonote::txout_to_scripthash); |