Skip to content

Commit

Permalink
Merge pull request #80 from panleone/refactor_addTransaction
Browse files Browse the repository at this point in the history
refactor addTransaction
  • Loading branch information
Duddino authored Mar 6, 2024
2 parents f874963 + 9c5d78a commit 7396db0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions js/pivx_shield.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,7 @@ export class PIVXShield {
await this.removeSpentNotes(res.nullifiers);
}
}
return res.decrypted_notes.filter(
(note) =>
!this.unspentNotes.some(
(note2) => JSON.stringify(note2[0]) === JSON.stringify(note[0]),
),
);
return res.decrypted_notes;
}

/**
Expand Down Expand Up @@ -386,9 +381,16 @@ export class PIVXShield {
if (useShieldInputs) {
this.pendingSpentNotes.set(txid, nullifiers);
}
const decryptedNewNotes = (await this.addTransaction(txhex, true)).filter(
(note) =>
!this.unspentNotes.some(
(note2) => JSON.stringify(note2[0]) === JSON.stringify(note[0]),
),
);

this.pendingUnspentNotes.set(
txid,
(await this.addTransaction(txhex, true)).map((n) => n[0]),
decryptedNewNotes.map((n) => n[0]),
);
return {
hex: txhex,
Expand Down

0 comments on commit 7396db0

Please sign in to comment.