-
Notifications
You must be signed in to change notification settings - Fork 94
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
fix(utxo): avoid index out of bounds panics in tx_details_by_hash #1915
Conversation
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.
LGTM, but I couldn't find test coverage for transaction_details_with_token_transfers
for BCH. Is the test_cashaddresses_in_tx_details_by_hash
test intended for it? It calls the tx_details_by_hash
in utxo_common. Otherwise, I don't see any problem that could cause the panic, we should wait for it to happen again and use the tx hash that you logged now as you wrote.
I am aware of these places but thanks @rozhkovdmitrii for pointing it out :) |
it also calls
Yeah, that is the intention of this PR, to prevent panic and to see what transactions were causing that in the future so that we can fix their deserializations if it were the problem. |
Yes, but the coin created in that test is |
Yeah, I missed that. Thanks for pointing it out. The changes here don't change anything of how the logic works though, it only returns errors where it's necessary, so no need to cover that in this PR. |
Sure, I approved the PR and opened an issue for this instead |
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.
My only feedback is that we might want to consider logging the full tx hex instead of the txid. I didn't trace where this is actually used, but if it's possible we are dealing with unconfirmed transactions, we may end up logging a txid that we can't retrieve the full hex for at a later time.
I will add hex logging in addition to txid. Thanks for the feedback. |
3f11705
Another user reported same issue, details below Reported by user User experiences loss of connection to mm2 when activating PND. Issue persists in all current releases for all GUIs using 1.0.5 mm2 log file ends with
Transaction mentioned in logs do not appear to be "exotic" ** Full Logs:** A test branch in legacy desktop is building at https://github.com/KomodoPlatform/komodo-wallet-desktop/actions/runs/5876114420 to confirm the fix |
These transactions are not the one that caused index out of bounds but the one after them, 1.0.6 will log the one that caused the panic though without causing panics, it will also not be included in history same as the above transactions. But this is still good info since now I know one of the coins that have problems with transaction deserialization and some examples of transactions that couldn't be deserialized properly. |
Partially fixes #1906
This PR addresses index out of bounds errors in the
tx_details_by_hash
functions. The changes replace direct array access with safer methods, avoiding potential panics due to out-of-range indices. In addition, error handling around the function was improved to log and skip transactions in case of errors.Please note that while this PR doesn't fully resolve the issue outlined in https://github.com/KomodoPlatform/komodo-wallet-desktop/issues/2317, as the transactions causing panics during history fetching will be skipped instead. The PR will facilitate the pinpointing of the actual problem by logging the transactions that cause these issues.