-
Notifications
You must be signed in to change notification settings - Fork 35
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 unconfirmed txs being weird #415
Conversation
✅ Deploy Preview for cheery-moxie-4f1121 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Could we move the TX sorting to pre-DB-write rather than at DB read? A downside being we would need to bump the DB version so we can keep sorting logic for existing clients with chronologically-incorrect TXDB, but imo, it's worth the small perf improvement. |
scripts/database.js
Outdated
@@ -327,6 +327,9 @@ export class Database { | |||
const store = this.#db | |||
.transaction('txs', 'readonly') | |||
.objectStore('txs'); | |||
// Put unconfirmed txs (blockHeight -1) as last |
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.
Why are unconfirmed txs stored in the DB in the first place?
in my opinion for this PR is better just to solve the bug |
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.
Some 'Pending' transactions (i.e: Shield Pending) act as if they're fully confirmed after restarting MPW directly after a Tx.
I'm assuming it's loading them from the DB as if they're confirmed, leads the balance to show as spendable when it is not, so Txs can fail temporarily.
Is this out of scope? Or should this PR handle such a case? Either way it is not optimal functionality.
I think that's fixed now |
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.
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.
tACK 9c2d843
Spammed various Shield Txs, refreshed the app, Txs were gone until synced via network - functionally sound.
Ideally in the future to prevent that 'disappearance' we integrate true mempool support via our RPC nodes, but that's a separate and larger project.
Abstract
Unconfirmed txs were incorrectly sorted at the beginning of the array txs, which lead to incorrect behavior.
Testing