Skip to content

Commit

Permalink
fix: multiple processors catching up same address
Browse files Browse the repository at this point in the history
  • Loading branch information
alexghr committed Nov 6, 2023
1 parent ba42998 commit 4d031d5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion yarn-project/pxe/src/synchronizer/synchronizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ export class Synchronizer {
* @returns A promise that resolves once the account is added to the Synchronizer.
*/
public addAccount(publicKey: PublicKey, keyStore: KeyStore, startingBlock: number) {
const processor = this.noteProcessors.find(x => x.publicKey.equals(publicKey));
const predicate = (x: NoteProcessor) => x.publicKey.equals(publicKey);
const processor = this.noteProcessors.find(predicate) ?? this.noteProcessorsToCatchUp.find(predicate);
if (processor) return;

this.noteProcessorsToCatchUp.push(new NoteProcessor(publicKey, keyStore, this.db, this.node, startingBlock));
Expand Down

0 comments on commit 4d031d5

Please sign in to comment.