simplewallet: new "address one-off <major> <minor>" command
This commit is contained in:
+12
-3
@@ -1548,6 +1548,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())
|
||||
@@ -2089,7 +2095,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;
|
||||
@@ -2167,7 +2174,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;
|
||||
@@ -12608,7 +12616,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;
|
||||
|
||||
@@ -793,6 +793,7 @@ private:
|
||||
size_t get_num_subaddresses(uint32_t index_major) const { return index_major < m_subaddress_labels.size() ? m_subaddress_labels[index_major].size() : 0; }
|
||||
void add_subaddress(uint32_t index_major, const std::string& label); // throws when index is out of bound
|
||||
void expand_subaddresses(const cryptonote::subaddress_index& index);
|
||||
void create_one_off_subaddress(const cryptonote::subaddress_index& index);
|
||||
std::string get_subaddress_label(const cryptonote::subaddress_index& index) const;
|
||||
void set_subaddress_label(const cryptonote::subaddress_index &index, const std::string &label);
|
||||
void set_subaddress_lookahead(size_t major, size_t minor);
|
||||
|
||||
Reference in New Issue
Block a user