aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-04-18 09:33:46 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-06-26 22:15:10 +0100
commit41be339655018d17c3169d3add8d5ca81f960c6a (patch)
tree148e8e46506e808c93b54ca7212c42aa0b675a0a /src/wallet/wallet2.cpp
parentwallet2: remove useless device locking (diff)
downloadmonero-41be339655018d17c3169d3add8d5ca81f960c6a.tar.xz
wallet2: avoid duplicate parsing of tx extra
Diffstat (limited to '')
-rw-r--r--src/wallet/wallet2.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index e220cc058..7ebc648bf 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -1146,15 +1146,18 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
}
// additional tx pubkeys and derivations for multi-destination transfers involving one or more subaddresses
- std::vector<crypto::public_key> additional_tx_pub_keys = get_additional_tx_pub_keys_from_extra(tx);
+ tx_extra_additional_pub_keys additional_tx_pub_keys;
std::vector<crypto::key_derivation> additional_derivations;
- for (size_t i = 0; i < additional_tx_pub_keys.size(); ++i)
+ if (find_tx_extra_field_by_type(tx_extra_fields, additional_tx_pub_keys))
{
- additional_derivations.push_back({});
- if (!hwdev.generate_key_derivation(additional_tx_pub_keys[i], keys.m_view_secret_key, additional_derivations.back()))
+ for (size_t i = 0; i < additional_tx_pub_keys.data.size(); ++i)
{
- MWARNING("Failed to generate key derivation from tx pubkey, skipping");
- additional_derivations.pop_back();
+ additional_derivations.push_back({});
+ if (!hwdev.generate_key_derivation(additional_tx_pub_keys.data[i], keys.m_view_secret_key, additional_derivations.back()))
+ {
+ MWARNING("Failed to generate key derivation from tx pubkey, skipping");
+ additional_derivations.pop_back();
+ }
}
}
hwdev_lock.unlock();
@@ -1187,7 +1190,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
THROW_WALLET_EXCEPTION_IF(tx_scan_info[i].error, error::acc_outs_lookup_error, tx, tx_pub_key, m_account.get_keys());
if (tx_scan_info[i].received)
{
- hwdev.conceal_derivation(tx_scan_info[i].received->derivation, tx_pub_key, additional_tx_pub_keys, derivation, additional_derivations);
+ hwdev.conceal_derivation(tx_scan_info[i].received->derivation, tx_pub_key, additional_tx_pub_keys.data, derivation, additional_derivations);
scan_output(tx, tx_pub_key, i, tx_scan_info[i], num_vouts_received, tx_money_got_in_outs, outs);
}
}
@@ -1210,7 +1213,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
THROW_WALLET_EXCEPTION_IF(tx_scan_info[i].error, error::acc_outs_lookup_error, tx, tx_pub_key, m_account.get_keys());
if (tx_scan_info[i].received)
{
- hwdev.conceal_derivation(tx_scan_info[i].received->derivation, tx_pub_key, additional_tx_pub_keys, derivation, additional_derivations);
+ hwdev.conceal_derivation(tx_scan_info[i].received->derivation, tx_pub_key, additional_tx_pub_keys.data, derivation, additional_derivations);
scan_output(tx, tx_pub_key, i, tx_scan_info[i], num_vouts_received, tx_money_got_in_outs, outs);
}
}
@@ -1226,7 +1229,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
{
hwdev_lock.lock();
hwdev.set_mode(hw::device::NONE);
- hwdev.conceal_derivation(tx_scan_info[i].received->derivation, tx_pub_key, additional_tx_pub_keys, derivation, additional_derivations);
+ hwdev.conceal_derivation(tx_scan_info[i].received->derivation, tx_pub_key, additional_tx_pub_keys.data, derivation, additional_derivations);
scan_output(tx, tx_pub_key, i, tx_scan_info[i], num_vouts_received, tx_money_got_in_outs, outs);
hwdev_lock.unlock();
}