diff --git a/yarn-project/aztec-rpc/src/synchroniser/synchroniser.ts b/yarn-project/aztec-rpc/src/synchroniser/synchroniser.ts index 9e10c49cc14..b1c25565d5e 100644 --- a/yarn-project/aztec-rpc/src/synchroniser/synchroniser.ts +++ b/yarn-project/aztec-rpc/src/synchroniser/synchroniser.ts @@ -138,6 +138,13 @@ export class Synchroniser { protected async workNoteProcessorCatchUp(limit = 1, retryInterval = 1000): Promise { const noteProcessor = this.noteProcessorsToCatchUp[0]; + if (noteProcessor.status.syncedToBlock === this.synchedToBlock) { + // Note processor already synched, nothing to do + this.noteProcessorsToCatchUp.shift(); + this.noteProcessors.push(noteProcessor); + return; + } + const from = noteProcessor.status.syncedToBlock + 1; // Ensuring that the note processor does not sync further than the main sync. limit = Math.min(limit, this.synchedToBlock - from + 1); @@ -230,14 +237,7 @@ export class Synchroniser { return; } - const noteProcessor = new NoteProcessor(publicKey, keyStore, this.db, this.node); - if (this.synchedToBlock === 0) { - // The main sync thread was never started before and for this reason the synchroniser does not have to catch up - this.noteProcessors.push(noteProcessor); - } else { - // The main sync thread was started before and for this reason the synchroniser has to catch up - this.noteProcessorsToCatchUp.push(noteProcessor); - } + this.noteProcessorsToCatchUp.push(new NoteProcessor(publicKey, keyStore, this.db, this.node)); } /**