Skip to content

Commit

Permalink
Fix Double sync (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
panleone authored Nov 9, 2023
1 parent d0d57c8 commit 2f18af7
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 4 deletions.
1 change: 1 addition & 0 deletions locale/de/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,4 @@ MIGRATION_ACCOUNT_FAILURE = "Wiederherstellen deines Accounts fehlgeschlagen. Bi
APP_INSTALLED = "Anwendung installiert!" # App Installed!
CONFIRM_POPUP_DELETE_ACCOUNT = "" # This will delete all your data, including masternodes contacts and private keys!
CONFIRM_POPUP_DELETE_ACCOUNT_TITLE = "" # Are you sure?
WALLET_NOT_SYNCED = "" # Please try again when wallet finishes syncing!
1 change: 1 addition & 0 deletions locale/en/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,4 @@ MIGRATION_ACCOUNT_FAILURE = "Failed to recover your account. Please reimport it.
APP_INSTALLED = "App Installed!" # App Installed!
CONFIRM_POPUP_DELETE_ACCOUNT = "This will delete all your data, including masternodes contacts and private keys!" # This will delete all your data, including masternodes contacts and private keys!
CONFIRM_POPUP_DELETE_ACCOUNT_TITLE = "Are you sure?" # Are you sure?
WALLET_NOT_SYNCED = "Please try again when wallet finishes syncing!" # Please try again when wallet finishes syncing!
1 change: 1 addition & 0 deletions locale/es-mx/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,4 @@ PROMO_NOT_ENOUGH = "" # You don't have enough {ticker} to create that code!
PROMO_ALREADY_CREATED = "" # You've already created that code!
CONFIRM_POPUP_DELETE_ACCOUNT = "" # This will delete all your data, including masternodes contacts and private keys!
CONFIRM_POPUP_DELETE_ACCOUNT_TITLE = "" # Are you sure?
WALLET_NOT_SYNCED = "" # Please try again when wallet finishes syncing!
1 change: 1 addition & 0 deletions locale/fr/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,4 @@ PROMO_NOT_ENOUGH = "" # You don't have enough {ticker} to create that code!
PROMO_ALREADY_CREATED = "" # You've already created that code!
CONFIRM_POPUP_DELETE_ACCOUNT = "" # This will delete all your data, including masternodes contacts and private keys!
CONFIRM_POPUP_DELETE_ACCOUNT_TITLE = "" # Are you sure?
WALLET_NOT_SYNCED = "" # Please try again when wallet finishes syncing!
1 change: 1 addition & 0 deletions locale/it/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,4 @@ PROMO_NOT_ENOUGH = "" # You don't have enough {ticker} to create that code!
PROMO_ALREADY_CREATED = "" # You've already created that code!
CONFIRM_POPUP_DELETE_ACCOUNT = "" # This will delete all your data, including masternodes contacts and private keys!
CONFIRM_POPUP_DELETE_ACCOUNT_TITLE = "" # Are you sure?
WALLET_NOT_SYNCED = "" # Please try again when wallet finishes syncing!
1 change: 1 addition & 0 deletions locale/nl/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,4 @@ MIGRATION_ACCOUNT_FAILURE = "Het herstellen van je account is mislukt. Importeer
APP_INSTALLED = "App geïnstalleerd!" # App Installed!
CONFIRM_POPUP_DELETE_ACCOUNT = "" # This will delete all your data, including masternodes contacts and private keys!
CONFIRM_POPUP_DELETE_ACCOUNT_TITLE = "" # Are you sure?
WALLET_NOT_SYNCED = "" # Please try again when wallet finishes syncing!
1 change: 1 addition & 0 deletions locale/ph/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,4 @@ PROMO_NOT_ENOUGH = "" # You don't have enough {ticker} to create that code!
PROMO_ALREADY_CREATED = "" # You've already created that code!
CONFIRM_POPUP_DELETE_ACCOUNT = "" # This will delete all your data, including masternodes contacts and private keys!
CONFIRM_POPUP_DELETE_ACCOUNT_TITLE = "" # Are you sure?
WALLET_NOT_SYNCED = "" # Please try again when wallet finishes syncing!
1 change: 1 addition & 0 deletions locale/pt-br/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,4 @@ CONFIRM_POPUP_VOTE_HTML = "Tem certeza? Demora 60 minutos para mudar o voto" # A
FAILED_TO_IMPORT_HARDWARE = "" # <b> Failed to import Hardware Wallet</b>.
CONFIRM_POPUP_DELETE_ACCOUNT = "" # This will delete all your data, including masternodes contacts and private keys!
CONFIRM_POPUP_DELETE_ACCOUNT_TITLE = "" # Are you sure?
WALLET_NOT_SYNCED = "" # Please try again when wallet finishes syncing!
1 change: 1 addition & 0 deletions locale/pt-pt/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,4 @@ CONFIRM_POPUP_VOTE_HTML = "Tem a certeza? Demora 60 minutos para mudar de voto"
FAILED_TO_IMPORT_HARDWARE = "" # <b> Failed to import Hardware Wallet</b>.
CONFIRM_POPUP_DELETE_ACCOUNT = "" # This will delete all your data, including masternodes contacts and private keys!
CONFIRM_POPUP_DELETE_ACCOUNT_TITLE = "" # Are you sure?
WALLET_NOT_SYNCED = "" # Please try again when wallet finishes syncing!
1 change: 1 addition & 0 deletions locale/template/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ WALLET_HARDWARE_NO_ACCESS = "<b>The OS denied access</b> Please check your Opera
WALLET_HARDWARE_CONNECTION_LOST = "<b>Lost connection to {hardwareWallet} </b><br>It seems the {hardwareWallet} was unplugged mid-operation, oops!"
WALLET_HARDWARE_BUSY = "<b>{hardwareWallet} is waiting</b><br>Please unlock your {hardwareWallet} or finish it's current prompt"
WALLET_HARDWARE_ERROR = "<b> {hardwareWallet} </b><br> {error}"
WALLET_NOT_SYNCED = "Please try again when wallet finishes syncing!"
CONFIRM_POPUP_VOTE = "Confirm Vote"
CONFIRM_POPUP_VOTE_HTML = "Are you sure? It takes 60 minutes to change vote"
CONFIRM_POPUP_TRANSACTION = "Confirm your transaction"
Expand Down
1 change: 1 addition & 0 deletions locale/uwu/translation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,4 @@ APP_INSTALLED = "App Instawlled!" # App Installed!
FAILED_TO_IMPORT_HARDWARE = "" # <b> Failed to import Hardware Wallet</b>.
CONFIRM_POPUP_DELETE_ACCOUNT = "" # This will delete all your data, including masternodes contacts and private keys!
CONFIRM_POPUP_DELETE_ACCOUNT_TITLE = "" # Are you sure?
WALLET_NOT_SYNCED = "" # Please try again when wallet finishes syncing!
10 changes: 6 additions & 4 deletions scripts/dashboard/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ async function importWallet({ type, secret, password = '' }) {
key = await parseSecret(secret, password);
}
if (key) {
const isAlreadyLoaded = wallet.isLoaded();
wallet.setMasterKey(key);
isImported.value = true;
jdenticonValue.value = wallet.getAddress();
Expand All @@ -184,10 +185,11 @@ async function importWallet({ type, secret, password = '' }) {
if (needsToEncrypt.value) showEncryptModal.value = true;
isViewOnly.value = wallet.isViewOnly();
await mempool.loadFromDisk();
await getNetwork().walletFullSync();
// Don't reload an already loaded wallet!
if (!isAlreadyLoaded) {
await mempool.loadFromDisk();
getNetwork().walletFullSync();
}
getEventEmitter().emit('wallet-import');
return true;
}
Expand Down
11 changes: 11 additions & 0 deletions scripts/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,11 @@ async function setAnalytics(level, fSilent = false) {
* Log out from the current wallet
*/
export async function logOut() {
const cNet = getNetwork();
if (!cNet.fullSynced && wallet.isLoaded()) {
createAlert('warning', `${ALERTS.WALLET_NOT_SYNCED}`, 3000);
return;
}
const fContinue = await confirmPopup({
title: `${ALERTS.CONFIRM_POPUP_DELETE_ACCOUNT_TITLE}`,
html: `
Expand Down Expand Up @@ -492,6 +497,12 @@ export async function logOut() {
* Toggle between Mainnet and Testnet
*/
export async function toggleTestnet() {
const cNet = getNetwork();
if (!cNet.fullSynced && wallet.isLoaded()) {
createAlert('warning', `${ALERTS.WALLET_NOT_SYNCED}`, 3000);
doms.domTestnetToggler.checked = cChainParams.current.isTestnet;
return;
}
const cNextNetwork = cChainParams.current.isTestnet
? cChainParams.main
: cChainParams.testnet;
Expand Down

0 comments on commit 2f18af7

Please sign in to comment.