Skip to content

Commit 0ad210d

Browse files
committed
Fix adding matured UTXOs to the account
1 parent 7506369 commit 0ad210d

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ use crate::wallet::managed_wallet_info::transaction_building::{
1313
use crate::wallet::managed_wallet_info::TransactionRecord;
1414
use crate::wallet::ManagedWalletInfo;
1515
use crate::{Network, Utxo, Wallet, WalletBalance};
16+
use dashcore::blockdata::transaction::OutPoint;
1617
use dashcore::{Address as DashAddress, Address, Transaction};
18+
19+
use crate::account::ManagedAccountTrait;
1720
use std::collections::BTreeSet;
1821

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

@@ -289,6 +303,17 @@ impl WalletInfoInterface for ManagedWalletInfo {
289303
false,
290304
);
291305
account.transactions.insert(tx.txid, tx_record);
306+
307+
// Add UTXOs for outputs that belong to this account
308+
let account_addresses: BTreeSet<Address> =
309+
account.all_addresses().into_iter().collect();
310+
account.add_utxos_from_transaction(
311+
&tx.transaction,
312+
&account_addresses,
313+
network,
314+
tx.height,
315+
true,
316+
);
292317
}
293318
}
294319

@@ -305,6 +330,17 @@ impl WalletInfoInterface for ManagedWalletInfo {
305330
false,
306331
);
307332
account.transactions.insert(tx.txid, tx_record);
333+
334+
// Add UTXOs for outputs that belong to this account
335+
let account_addresses: BTreeSet<Address> =
336+
account.all_addresses().into_iter().collect();
337+
account.add_utxos_from_transaction(
338+
&tx.transaction,
339+
&account_addresses,
340+
network,
341+
tx.height,
342+
true,
343+
);
308344
}
309345
}
310346
}

0 commit comments

Comments
 (0)