-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wallet2: fix double counting outs if more than one pubkey #3985
Conversation
Wait. That's wrong, it just works by accudent on that test case. Will fix better. |
f193eea
to
7035646
Compare
src/wallet/wallet2.cpp
Outdated
@@ -1147,13 +1155,16 @@ 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; | |||
for (size_t i = 0; i < additional_tx_pub_keys.size(); ++i) | |||
if (pk_index == 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see now how that strange amount was caused (i.e. the tx had two identical tx pubkeys which falsely doubled the received amount), but I wonder if this part is necessary/relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those keys only need to be generated/checked once, same idea, though these don't actually cause a problem technically so its mostly a speedup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, but I doubt there would be any real speedup, because the subaddress PR was merged much later (October 2017) than when the cold signing bug was found and fixed (December 2016); it wouldn't have been possible for anyone to create a tx which mistakenly has two tx public keys due to the cold signing bug and then to simultaneously attach additional tx public keys which are specific to the subaddresses scheme.
Not that I'm strongly against it, just feels a little strange to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed
7035646
to
58cceaa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed
58cceaa wallet2: fix double counting outs if the tx pubkey is duplicated (moneromooo-monero)
Transactions from the web wallet could have a duplicated public key, which caused the Monero wallet to double-count ins and outs. Fixed by applying upstream patch (Monero PR monero-project#3985).
No description provided.