mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-11 05:04:35 +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();
|
.toList();
|
||||||
|
|
||||||
await _db.isar.writeTxn(() async {
|
await _db.isar.writeTxn(() async {
|
||||||
await _db.isar.addresses
|
for (final newAddress in updatedAddresses) {
|
||||||
.deleteAll(updatedAddresses.map((e) => e.id).toList());
|
final oldAddress = await _db.getAddress(
|
||||||
await _db.isar.addresses.putAll(updatedAddresses);
|
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;
|
return updatedAddresses;
|
||||||
|
|
Loading…
Reference in a new issue