fix bitcoin frost wallet restoration

This commit is contained in:
sneurlax 2024-01-29 23:29:52 -06:00
parent a100e6a15c
commit cce94676a6
2 changed files with 8 additions and 4 deletions

View file

@ -97,7 +97,9 @@ class _RestoreFrostMsWalletViewState
),
);
await ref.read(mainDBProvider).isar.writeTxn(() async {
await ref.read(mainDBProvider).isar.frostWalletInfo.put(frostInfo);
});
await (wallet as BitcoinFrostWallet).recover(
serializedKeys: keys,

View file

@ -718,8 +718,9 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
if (knownSalts.contains(salt)) {
throw Exception("Known frost multisig salt found!");
}
knownSalts.add(salt);
await _updateKnownSalts(knownSalts);
List<String> updatedKnownSalts = List<String>.from(knownSalts);
updatedKnownSalts.add(salt);
await _updateKnownSalts(updatedKnownSalts);
} else {
// clear cache
await electrumXCachedClient.clearSharedTransactionCache(coin: coin);
@ -1001,8 +1002,9 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
.findFirstSync()!;
Future<void> _updateKnownSalts(List<String> knownSalts) async {
await mainDB.isar.writeTxn(() async {
final info = frostInfo;
await mainDB.isar.writeTxn(() async {
await mainDB.isar.frostWalletInfo.delete(info.id);
await mainDB.isar.frostWalletInfo.put(
info.copyWith(knownSalts: knownSalts),