wallet2: avoid duplicate parsing of tx extra
This commit is contained in:
parent
f7f1917ed4
commit
41be339655
|
@ -1146,17 +1146,20 @@ 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
|
// 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;
|
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))
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < additional_tx_pub_keys.data.size(); ++i)
|
||||||
{
|
{
|
||||||
additional_derivations.push_back({});
|
additional_derivations.push_back({});
|
||||||
if (!hwdev.generate_key_derivation(additional_tx_pub_keys[i], keys.m_view_secret_key, additional_derivations.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");
|
MWARNING("Failed to generate key derivation from tx pubkey, skipping");
|
||||||
additional_derivations.pop_back();
|
additional_derivations.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
hwdev_lock.unlock();
|
hwdev_lock.unlock();
|
||||||
|
|
||||||
if (miner_tx && m_refresh_type == RefreshNoCoinbase)
|
if (miner_tx && m_refresh_type == RefreshNoCoinbase)
|
||||||
|
@ -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());
|
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)
|
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);
|
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());
|
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)
|
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);
|
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_lock.lock();
|
||||||
hwdev.set_mode(hw::device::NONE);
|
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);
|
scan_output(tx, tx_pub_key, i, tx_scan_info[i], num_vouts_received, tx_money_got_in_outs, outs);
|
||||||
hwdev_lock.unlock();
|
hwdev_lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue