fix rescans

This commit is contained in:
sneurlax 2024-03-12 07:45:49 -05:00
parent 64b0f23910
commit 95bb47aaf8

View file

@ -698,10 +698,14 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
String? multisigConfig, String? multisigConfig,
}) async { }) async {
if (serializedKeys == null || multisigConfig == null) { if (serializedKeys == null || multisigConfig == null) {
throw Exception( serializedKeys = await getSerializedKeys();
"Failed to recover $runtimeType: " multisigConfig = await getMultisigConfig();
"Missing serializedKeys and/or multisigConfig.", }
); if (serializedKeys == null || multisigConfig == null) {
String err = "${info.coinName} wallet ${info.walletId} had null keys/cfg";
Logging.instance.log(err, level: LogLevel.Fatal);
throw Exception(err);
// TODO [prio=low]: handle null keys or config. This should not happen.
} }
final coin = info.coin; final coin = info.coin;
@ -719,7 +723,7 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
if (!isRescan) { if (!isRescan) {
final salt = frost final salt = frost
.multisigSalt( .multisigSalt(
multisigConfig: multisigConfig, multisigConfig: multisigConfig!,
) )
.toHex; .toHex;
final knownSalts = _getKnownSalts(); final knownSalts = _getKnownSalts();
@ -735,9 +739,9 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T> {
await mainDB.deleteWalletBlockchainData(walletId); await mainDB.deleteWalletBlockchainData(walletId);
} }
final keys = frost.deserializeKeys(keys: serializedKeys); final keys = frost.deserializeKeys(keys: serializedKeys!);
await _saveSerializedKeys(serializedKeys); await _saveSerializedKeys(serializedKeys!);
await _saveMultisigConfig(multisigConfig); await _saveMultisigConfig(multisigConfig!);
final addressString = frost.addressForKeys( final addressString = frost.addressForKeys(
network: cryptoCurrency.network == CryptoCurrencyNetwork.main network: cryptoCurrency.network == CryptoCurrencyNetwork.main