mirror of
https://github.com/monero-project/monero.git
synced 2024-12-23 03:59:33 +00:00
wallet2: avoid duplicate parsing of tx extra
This commit is contained in:
parent
f7f1917ed4
commit
41be339655
1 changed files with 12 additions and 9 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue