diff options
author | stoffu <stoffu@protonmail.ch> | 2018-07-23 23:45:11 +0900 |
---|---|---|
committer | stoffu <stoffu@protonmail.ch> | 2018-07-31 21:36:12 +0900 |
commit | 1c6cfd34f4ad5939ebeb29a9776faf2f29c8b04f (patch) | |
tree | b7c3f8598f2f975b1deb98ef3288f4ec16f5d681 /src/wallet/wallet2.cpp | |
parent | Merge pull request #4088 (diff) | |
download | monero-1c6cfd34f4ad5939ebeb29a9776faf2f29c8b04f.tar.xz |
wallet-rpc: add get_address_index command
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r-- | src/wallet/wallet2.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index c2c02dd67..39e5cce80 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -899,6 +899,14 @@ cryptonote::account_public_address wallet2::get_subaddress(const cryptonote::sub return hwdev.get_subaddress(m_account.get_keys(), index); } //---------------------------------------------------------------------------------------------------- +boost::optional<cryptonote::subaddress_index> wallet2::get_subaddress_index(const cryptonote::account_public_address& address) const +{ + auto index = m_subaddresses.find(address.m_spend_public_key); + if (index == m_subaddresses.end()) + return boost::none; + return index->second; +} +//---------------------------------------------------------------------------------------------------- crypto::public_key wallet2::get_subaddress_spend_public_key(const cryptonote::subaddress_index& index) const { hw::device &hwdev = m_account.get_device(); |