put or update address instead of assuming it doesn't exist in db (it shouldn't exist in db though...)

This commit is contained in:
julian 2024-01-10 16:48:41 -06:00
parent af02bddef1
commit 37a164bb8f

View file

@ -36,7 +36,7 @@ abstract class Bip39HDWallet<T extends Bip39HDCurrency> extends Bip39Wallet<T>
derivePathType: DerivePathTypeExt.primaryFor(info.coin),
);
await mainDB.putAddress(address);
await mainDB.updateOrPutAddresses([address]);
await info.updateReceivingAddress(
newAddress: address.value,
isar: mainDB.isar,
@ -58,9 +58,7 @@ abstract class Bip39HDWallet<T extends Bip39HDCurrency> extends Bip39Wallet<T>
derivePathType: DerivePathTypeExt.primaryFor(info.coin),
);
await mainDB.isar.writeTxn(() async {
await mainDB.isar.addresses.put(address);
});
await mainDB.updateOrPutAddresses([address]);
}
// ========== Subclasses may override ========================================