Skip to content

Commit aac7324

Browse files
committed
Fix adding matured UTXOs to the account
1 parent a10b6d0 commit aac7324

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

key-wallet/src/wallet/managed_wallet_info/wallet_info_interface.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ use crate::wallet::managed_wallet_info::TransactionRecord;
1414
use crate::wallet::ManagedWalletInfo;
1515
use crate::{Network, Utxo, Wallet, WalletBalance};
1616
use dashcore::{Address as DashAddress, Address, Transaction};
17+
18+
use crate::account::ManagedAccountTrait;
1719
use std::collections::BTreeSet;
1820

1921
/// Trait that wallet info types must implement to work with WalletManager
@@ -272,6 +274,17 @@ impl WalletInfoInterface for ManagedWalletInfo {
272274
false, // Not ours (we received)
273275
);
274276
account.transactions.insert(tx.txid, tx_record);
277+
278+
// Add UTXOs for outputs that belong to this account
279+
let account_addresses: BTreeSet<Address> =
280+
account.all_addresses().into_iter().collect();
281+
account.add_utxos_from_transaction(
282+
&tx.transaction,
283+
&account_addresses,
284+
network,
285+
tx.height,
286+
true,
287+
);
275288
}
276289
}
277290

@@ -289,6 +302,17 @@ impl WalletInfoInterface for ManagedWalletInfo {
289302
false,
290303
);
291304
account.transactions.insert(tx.txid, tx_record);
305+
306+
// Add UTXOs for outputs that belong to this account
307+
let account_addresses: BTreeSet<Address> =
308+
account.all_addresses().into_iter().collect();
309+
account.add_utxos_from_transaction(
310+
&tx.transaction,
311+
&account_addresses,
312+
network,
313+
tx.height,
314+
true,
315+
);
292316
}
293317
}
294318

@@ -305,6 +329,17 @@ impl WalletInfoInterface for ManagedWalletInfo {
305329
false,
306330
);
307331
account.transactions.insert(tx.txid, tx_record);
332+
333+
// Add UTXOs for outputs that belong to this account
334+
let account_addresses: BTreeSet<Address> =
335+
account.all_addresses().into_iter().collect();
336+
account.add_utxos_from_transaction(
337+
&tx.transaction,
338+
&account_addresses,
339+
network,
340+
tx.height,
341+
true,
342+
);
308343
}
309344
}
310345
}

0 commit comments

Comments
 (0)