Skip to content

Commit 3814161

Browse files
committed
Squashed commit of the following:
commit bc116ee Author: xdustinface <xdustinfacex@gmail.com> Date: Wed Dec 24 09:59:48 2025 +0100 refactor: simplify immature transactions handling
1 parent c8b1548 commit 3814161

File tree

8 files changed

+100
-857
lines changed

8 files changed

+100
-857
lines changed

key-wallet/src/managed_account/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,15 @@ impl ManagedAccount {
265265
}
266266

267267
/// Update the account balance
268-
pub fn update_balance(&mut self) {
268+
pub fn update_balance(&mut self, synced_height: u32) {
269269
let mut spendable = 0;
270270
let mut unconfirmed = 0;
271271
let mut locked = 0;
272272
for utxo in self.utxos.values() {
273273
let value = utxo.txout.value;
274274
if utxo.is_locked {
275275
locked += value;
276-
} else if utxo.is_confirmed {
276+
} else if utxo.is_spendable(synced_height) {
277277
spendable += value;
278278
} else {
279279
unconfirmed += value;

key-wallet/src/tests/immature_transaction_tests.rs

Lines changed: 0 additions & 289 deletions
This file was deleted.

key-wallet/src/tests/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ mod backup_restore_tests;
1212

1313
mod edge_case_tests;
1414

15-
mod immature_transaction_tests;
16-
1715
mod integration_tests;
1816

1917
mod managed_account_collection_tests;

0 commit comments

Comments
 (0)