Skip to content

Commit

Permalink
Merge pull request #325 from cashubtc/fix-restore-proofsStore
Browse files Browse the repository at this point in the history
Fix: restore use `proofsStore`
  • Loading branch information
callebtc authored Jan 24, 2025
2 parents e88d19d + 80d3b10 commit 82347fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/stores/restore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { notify, notifyError, notifySuccess } from "src/js/notify";
import { useUiStore } from "./ui";
import { useProofsStore } from "./proofs";

const BATCH_SIZE = 100;
const MAX_GAP = 1;
const BATCH_SIZE = 200;
const MAX_GAP = 2;

export const useRestoreStore = defineStore("restore", {
state: () => ({
Expand Down Expand Up @@ -53,6 +53,7 @@ export const useRestoreStore = defineStore("restore", {
}
this.restoreProgress = 0;
const walletStore = useWalletStore();
const proofsStore = useProofsStore();
const mintStore = useMintsStore();
await mintStore.activateMintUrl(url);

Expand Down Expand Up @@ -131,7 +132,7 @@ export const useRestoreStore = defineStore("restore", {
);
}
const newProofs = unspentProofs.filter(
(p) => !mintStore.proofs.some((pr) => pr.secret === p.secret)
(p) => !proofsStore.proofs.some((pr) => pr.secret === p.secret)
);
await useProofsStore().addProofs(newProofs);
restoredProofs = restoredProofs.concat(newProofs);
Expand Down
2 changes: 1 addition & 1 deletion src/stores/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const useStorageStore = defineStore("storage", {
jsonToSave[k] = v;
}
// proofs table *magic*
const proofs = await useProofsStore().getProofs()
const proofs = await useProofsStore().getProofs();
jsonToSave["cashu.dexie.db.proofs"] = JSON.stringify(proofs);

var textToSave = JSON.stringify(jsonToSave);
Expand Down

0 comments on commit 82347fe

Please sign in to comment.