clear lelantus coins on full rescan

This commit is contained in:
julian 2023-07-25 11:18:21 -06:00
parent 5f9b1f77f5
commit e1140e6fa6

View file

@ -371,6 +371,7 @@ class MainDB {
final transactionCount = await getTransactions(walletId).count();
final addressCount = await getAddresses(walletId).count();
final utxoCount = await getUTXOs(walletId).count();
final lelantusCoinCount = await isar.lelantusCoins.where().walletIdEqualTo(walletId).count();
await isar.writeTxn(() async {
const paginateLimit = 50;
@ -404,6 +405,16 @@ class MainDB {
.findAll();
await isar.utxos.deleteAll(utxoIds);
}
// lelantusCoins
for (int i = 0; i < lelantusCoinCount; i += paginateLimit) {
final lelantusCoinIds = await isar.lelantusCoins.where().walletIdEqualTo(walletId)
.offset(i)
.limit(paginateLimit)
.idProperty()
.findAll();
await isar.lelantusCoins.deleteAll(lelantusCoinIds);
}
});
}