Skip to content

Commit

Permalink
Added height check for rewind wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
n9lsjr committed Feb 4, 2024
1 parent 0e72e25 commit 37162ae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/backend/electron.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ ipcMain.on("reset-wallet", (e, height) => {
});

ipcMain.on("rewind-wallet", async (e, height) => {

successMessage(`Rewind wallet from height ${height}`)
walletBackend.rewind(parseInt(height));

});
Expand Down
14 changes: 10 additions & 4 deletions src/routes/wallet/settings/wallet/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,22 @@
let height = 0;
const resetWallet = () => {
if (height > $node.networkBlockCount) {
window.api.errorMessage('Cannot scan from height');
return;
}
if (!checkHeight(height)) return;
window.api.resetWallet(height);
};
const rewindWallet = () => {
if (!checkHeight(height)) return;
window.api.rewindWallet(height);
};
const checkHeight = (h) => {
if (h > $node.networkBlockCount) {
window.api.errorMessage('Cannot scan from height');
return false;
}
return true;
};
</script>

<div class="wrapper">
Expand Down

0 comments on commit 37162ae

Please sign in to comment.