Fix issue for new wallets with seed offsets

This commit is contained in:
pokkst 2022-12-04 11:07:36 -06:00
parent fd78ebc89c
commit 8ddb57e36d
No known key found for this signature in database
GPG key ID: 90C2ED85E67A50FF

View file

@ -225,6 +225,10 @@ public class OnboardingFragment extends Fragment {
long restoreHeight = getNewRestoreHeight(); long restoreHeight = getNewRestoreHeight();
File walletFile = new File(mainActivity.getApplicationInfo().dataDir, Constants.WALLET_NAME); File walletFile = new File(mainActivity.getApplicationInfo().dataDir, Constants.WALLET_NAME);
Wallet wallet = null; Wallet wallet = null;
if(!offset.isEmpty()) {
PrefService.getInstance().edit().putBoolean(Constants.PREF_USES_OFFSET, true).apply();
}
if (walletSeed.isEmpty()) { if (walletSeed.isEmpty()) {
Wallet tmpWallet = createTempWallet(mainActivity.getApplicationInfo().dataDir); //we do this to get seed, then recover wallet so we can use seed offset Wallet tmpWallet = createTempWallet(mainActivity.getApplicationInfo().dataDir); //we do this to get seed, then recover wallet so we can use seed offset
wallet = WalletManager.getInstance().recoveryWallet(walletFile, walletPassword, tmpWallet.getSeed(""), offset, restoreHeight); wallet = WalletManager.getInstance().recoveryWallet(walletFile, walletPassword, tmpWallet.getSeed(""), offset, restoreHeight);
@ -236,9 +240,6 @@ public class OnboardingFragment extends Fragment {
if (!restoreHeightText.isEmpty()) { if (!restoreHeightText.isEmpty()) {
restoreHeight = Long.parseLong(restoreHeightText); restoreHeight = Long.parseLong(restoreHeightText);
} }
if(!offset.isEmpty()) {
PrefService.getInstance().edit().putBoolean(Constants.PREF_USES_OFFSET, true).apply();
}
wallet = WalletManager.getInstance().recoveryWallet(walletFile, walletPassword, walletSeed, offset, restoreHeight); wallet = WalletManager.getInstance().recoveryWallet(walletFile, walletPassword, walletSeed, offset, restoreHeight);
} }
Wallet.Status walletStatus = wallet.getStatus(); Wallet.Status walletStatus = wallet.getStatus();