mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +00:00
possible index violation error fix
This commit is contained in:
parent
c2dd868421
commit
a5930647a8
1 changed files with 13 additions and 3 deletions
|
@ -336,9 +336,19 @@ mixin FusionWalletInterface {
|
|||
.toList();
|
||||
|
||||
await _db.isar.writeTxn(() async {
|
||||
await _db.isar.addresses
|
||||
.deleteAll(updatedAddresses.map((e) => e.id).toList());
|
||||
await _db.isar.addresses.putAll(updatedAddresses);
|
||||
for (final newAddress in updatedAddresses) {
|
||||
final oldAddress = await _db.getAddress(
|
||||
newAddress.walletId,
|
||||
newAddress.value,
|
||||
);
|
||||
|
||||
if (oldAddress != null) {
|
||||
newAddress.id = oldAddress.id;
|
||||
await _db.isar.addresses.delete(oldAddress.id);
|
||||
}
|
||||
|
||||
await _db.isar.addresses.put(newAddress);
|
||||
}
|
||||
});
|
||||
|
||||
return updatedAddresses;
|
||||
|
|
Loading…
Reference in a new issue