Skip to content

Commit

Permalink
fix restoring of xmr/wow wallets during swb restore process
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-CStack committed Nov 28, 2024
1 parent dbf68f2 commit 9e988b8
Showing 1 changed file with 29 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -503,33 +503,43 @@ abstract class SWB {
viewOnlyData: viewOnlyData,
);

if (wallet is MoneroWallet /*|| wallet is WowneroWallet doesn't work.*/) {
await wallet.init(isRestore: true);
} else if (wallet is WowneroWallet) {
await wallet.init(isRestore: true);
} else {
await wallet.init();
switch (wallet.runtimeType) {
case const (EpiccashWallet):
await (wallet as EpiccashWallet).init(isRestore: true);
break;

case const (MoneroWallet):
await (wallet as MoneroWallet).init(isRestore: true);
break;

case const (WowneroWallet):
await (wallet as WowneroWallet).init(isRestore: true);
break;

default:
await wallet.init();
}

int restoreHeight = walletbackup['restoreHeight'] as int? ?? 0;
if (restoreHeight <= 0) {
restoreHeight = walletbackup['storedChainHeight'] as int? ?? 0;
}

Future<void>? restoringFuture;

if (!(wallet is LibMoneroWallet || wallet is EpiccashWallet)) {
if (wallet is BitcoinFrostWallet) {
restoringFuture = wallet.recover(
isRescan: false,
multisigConfig: multisigConfig!,
serializedKeys: serializedKeys!,
);
if (wallet is EpiccashWallet || wallet is LibMoneroWallet) {
restoreHeight = 0;
} else {
restoringFuture = wallet.recover(isRescan: false);
restoreHeight = walletbackup['storedChainHeight'] as int? ?? 0;
}
}

final Future<void>? restoringFuture;
if (wallet is BitcoinFrostWallet) {
restoringFuture = wallet.recover(
isRescan: false,
multisigConfig: multisigConfig!,
serializedKeys: serializedKeys!,
);
} else {
restoringFuture = wallet.recover(isRescan: false);
}

uiState?.update(
walletId: info.walletId,
restoringStatus: StackRestoringStatus.restoring,
Expand Down

0 comments on commit 9e988b8

Please sign in to comment.