mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 02:24:30 +00:00
clear lelantus coins on full rescan
This commit is contained in:
parent
5f9b1f77f5
commit
e1140e6fa6
1 changed files with 11 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue