wallet2: fix double counting outs if the tx pubkey is duplicated
This commit is contained in:
parent
2daf54deeb
commit
8c331a6d26
|
@ -1110,6 +1110,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
|
|||
// Don't try to extract tx public key if tx has no ouputs
|
||||
size_t pk_index = 0;
|
||||
std::vector<tx_scan_info_t> tx_scan_info(tx.vout.size());
|
||||
std::unordered_set<crypto::public_key> public_keys_seen;
|
||||
while (!tx.vout.empty())
|
||||
{
|
||||
// if tx.vout is not empty, we loop through all tx pubkeys
|
||||
|
@ -1125,6 +1126,13 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
|
|||
break;
|
||||
}
|
||||
|
||||
if (public_keys_seen.find(pub_key_field.pub_key) != public_keys_seen.end())
|
||||
{
|
||||
MWARNING("The same transaction pubkey is present more than once, ignoring extra instance");
|
||||
continue;
|
||||
}
|
||||
public_keys_seen.insert(pub_key_field.pub_key);
|
||||
|
||||
int num_vouts_received = 0;
|
||||
tx_pub_key = pub_key_field.pub_key;
|
||||
tools::threadpool& tpool = tools::threadpool::getInstance();
|
||||
|
@ -1144,6 +1152,8 @@ 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);
|
||||
std::vector<crypto::key_derivation> additional_derivations;
|
||||
if (pk_index == 1)
|
||||
{
|
||||
for (size_t i = 0; i < additional_tx_pub_keys.size(); ++i)
|
||||
{
|
||||
additional_derivations.push_back({});
|
||||
|
@ -1153,6 +1163,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
|
|||
additional_derivations.pop_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
hwdev_lock.unlock();
|
||||
|
||||
if (miner_tx && m_refresh_type == RefreshNoCoinbase)
|
||||
|
|
Loading…
Reference in New Issue