-
Notifications
You must be signed in to change notification settings - Fork 11
refactor: consolidate balance calculations #338
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -235,24 +235,6 @@ impl WalletTransactionChecker for ManagedWalletInfo { | |
| for input in &tx.input { | ||
| account.utxos.remove(&input.previous_output); | ||
| } | ||
|
|
||
| // Recalculate account balance from UTXOs | ||
| let mut confirmed = 0u64; | ||
| let mut unconfirmed = 0u64; | ||
| let mut locked = 0u64; | ||
|
|
||
| for utxo in account.utxos.values() { | ||
| let value = utxo.txout.value; | ||
| if utxo.is_locked { | ||
| locked += value; | ||
| } else if utxo.is_confirmed { | ||
| confirmed += value; | ||
| } else { | ||
| unconfirmed += value; | ||
| } | ||
| } | ||
|
|
||
| let _ = account.update_balance(confirmed, unconfirmed, locked); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure you can remove this update call??
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah it's just moved into |
||
| } | ||
| _ => { | ||
| // Skip UTXO ingestion for identity/provider accounts | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.