aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2020-04-10 16:06:10 -0500
committerluigi1111 <luigi1111w@gmail.com>2020-04-10 16:06:10 -0500
commitbce050ee7827b630f5fce6922854c0d7d3a3896d (patch)
treea1c531f46b8fc9e45614864d1a221525ab0ed05b /src/wallet/wallet2.cpp
parentMerge pull request #6358 (diff)
parentsimplewallet: new "address one-off <major> <minor>" command (diff)
downloadmonero-bce050ee7827b630f5fce6922854c0d7d3a3896d.tar.xz
Merge pull request #6394
69b5992 simplewallet: new 'address one-off <major> <minor>' command (moneromooo-monero)
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r--src/wallet/wallet2.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index f05a67315..bc8219c69 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -1553,6 +1553,12 @@ void wallet2::expand_subaddresses(const cryptonote::subaddress_index& index)
}
}
//----------------------------------------------------------------------------------------------------
+void wallet2::create_one_off_subaddress(const cryptonote::subaddress_index& index)
+{
+ const crypto::public_key pkey = get_subaddress_spend_public_key(index);
+ m_subaddresses[pkey] = index;
+}
+//----------------------------------------------------------------------------------------------------
std::string wallet2::get_subaddress_label(const cryptonote::subaddress_index& index) const
{
if (index.major >= m_subaddress_labels.size() || index.minor >= m_subaddress_labels[index.major].size())
@@ -2094,7 +2100,8 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
td.m_amount = amount;
td.m_pk_index = pk_index - 1;
td.m_subaddr_index = tx_scan_info[o].received->index;
- expand_subaddresses(tx_scan_info[o].received->index);
+ if (tx_scan_info[o].received->index.major < m_subaddress_labels.size() && tx_scan_info[o].received->index.minor < m_subaddress_labels[tx_scan_info[o].received->index.major].size())
+ expand_subaddresses(tx_scan_info[o].received->index);
if (tx.vout[o].amount == 0)
{
td.m_mask = tx_scan_info[o].mask;
@@ -2172,7 +2179,8 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
td.m_amount = amount;
td.m_pk_index = pk_index - 1;
td.m_subaddr_index = tx_scan_info[o].received->index;
- expand_subaddresses(tx_scan_info[o].received->index);
+ if (tx_scan_info[o].received->index.major < m_subaddress_labels.size() && tx_scan_info[o].received->index.minor < m_subaddress_labels[tx_scan_info[o].received->index.major].size())
+ expand_subaddresses(tx_scan_info[o].received->index);
if (tx.vout[o].amount == 0)
{
td.m_mask = tx_scan_info[o].mask;
@@ -12676,7 +12684,8 @@ process:
const crypto::public_key& out_key = boost::get<cryptonote::txout_to_key>(td.m_tx.vout[td.m_internal_output_index].target).key;
bool r = cryptonote::generate_key_image_helper(m_account.get_keys(), m_subaddresses, out_key, tx_pub_key, additional_tx_pub_keys, td.m_internal_output_index, in_ephemeral, td.m_key_image, m_account.get_device());
THROW_WALLET_EXCEPTION_IF(!r, error::wallet_internal_error, "Failed to generate key image");
- expand_subaddresses(td.m_subaddr_index);
+ if (td.m_subaddr_index.major < m_subaddress_labels.size() && td.m_subaddr_index.minor < m_subaddress_labels[td.m_subaddr_index.major].size())
+ expand_subaddresses(td.m_subaddr_index);
td.m_key_image_known = true;
td.m_key_image_request = true;
td.m_key_image_partial = false;