Skip to content

Commit

Permalink
Handle the case in which loaded data is incompatible with current ver…
Browse files Browse the repository at this point in the history
…sion
  • Loading branch information
panleone committed Oct 14, 2024
1 parent bdef58c commit 328b790
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions js/pivx_shield.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,17 @@ export class PIVXShield {
shieldData.commitmentTree,
);
pivxShield.mapNullifierNote = new Map(
Object.entries(shieldData.mapNullifierNote),
Object.entries(shieldData.mapNullifierNote ?? {}),
);
pivxShield.diversifierIndex = shieldData.diversifierIndex;
pivxShield.unspentNotes = shieldData.unspentNotes;
return pivxShield;

// Shield activity update: mapNullifierNote must be present in the shieldData
let success = true;
if (!shieldData.mapNullifierNote) {
success = false;
}
return { pivxShield, success };
}

/**
Expand Down

0 comments on commit 328b790

Please sign in to comment.