-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: process txs as they arrive #810
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #810 +/- ##
==========================================
+ Coverage 80.68% 80.75% +0.07%
==========================================
Files 85 86 +1
Lines 6549 6594 +45
Branches 1419 1430 +11
==========================================
+ Hits 5284 5325 +41
- Misses 1252 1256 +4
Partials 13 13 ☔ View full report in Codecov by Sentry. |
if (metadataChanged) { | ||
// Process the full history because | ||
// this tx changed the voided state | ||
// XXX in the future we should be able to handle this | ||
// voidness alone, without processing everything | ||
// but for now it's an isolated case and it's easier | ||
await this.storage.processHistory(); | ||
} else if (isNewTx) { | ||
// Process this single transaction. | ||
// Handling new metadatas and deleting utxos that are not available anymore | ||
await this.storage.processNewTx(newTx); | ||
} | ||
// restore previous state | ||
this.state = previousState; |
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.
Comment semi-related to line number
Code looks ok, but should we add tests for this new mechanism?
Context
Nowadays we run the method to process the wallet full history every time a new tx arrives in the ws. Wallets with many transactions/addresses usually take a long time (0.5s) to process their entire history. There are cases where the wallet returns and error because of insufficient funds because it's processing the history of a recent transaction that has just arrived when the user wants to send a new tx.
Acceptance Criteria
Security Checklist