@@ -14,7 +14,7 @@ import type { SenderAddressBookStore } from '../storage/tagging_store/sender_add
1414import {
1515 getAllPrivateLogsByTags ,
1616 getAllPublicLogsByTagsFromContract ,
17- loadPrivateLogsForSenderRecipientPair ,
17+ syncTaggedPrivateLogs ,
1818} from '../tagging/index.js' ;
1919
2020export class LogService {
@@ -116,37 +116,23 @@ export class LogService {
116116 public async fetchTaggedLogs ( contractAddress : AztecAddress , recipient : AztecAddress ) : Promise < PendingTaggedLog [ ] > {
117117 this . log . verbose ( `Fetching tagged logs for ${ contractAddress . toString ( ) } ` ) ;
118118
119- // We only load logs from block up to and including the anchor block number
120- const anchorBlockNumber = this . anchorBlockHeader . getBlockNumber ( ) ;
121- const anchorBlockHash = await this . anchorBlockHeader . hash ( ) ;
122-
123119 const l2Tips = await this . l2TipsStore . getL2Tips ( ) ;
124- const currentTimestamp = this . anchorBlockHeader . globalVariables . timestamp ;
125120 // Get all secrets for this recipient (one per sender)
126121 const secrets = await this . #getSecretsForSenders( contractAddress , recipient ) ;
127122
128- // Load logs for all sender-recipient pairs in parallel
129- const logArrays = await Promise . all (
130- secrets . map ( secret =>
131- loadPrivateLogsForSenderRecipientPair (
132- secret ,
133- this . aztecNode ,
134- this . recipientTaggingStore ,
135- anchorBlockNumber ,
136- anchorBlockHash ,
137- currentTimestamp ,
138- l2Tips . finalized . block . number ,
139- this . jobId ,
140- ) ,
141- ) ,
123+ const logs = await syncTaggedPrivateLogs (
124+ secrets ,
125+ this . aztecNode ,
126+ this . recipientTaggingStore ,
127+ this . anchorBlockHeader ,
128+ l2Tips . finalized . block . number ,
129+ this . jobId ,
142130 ) ;
143131
144- return logArrays
145- . flat ( )
146- . map (
147- scopedLog =>
148- new PendingTaggedLog ( scopedLog . logData , scopedLog . txHash , scopedLog . noteHashes , scopedLog . firstNullifier ) ,
149- ) ;
132+ return logs . map (
133+ scopedLog =>
134+ new PendingTaggedLog ( scopedLog . logData , scopedLog . txHash , scopedLog . noteHashes , scopedLog . firstNullifier ) ,
135+ ) ;
150136 }
151137
152138 async #getSecretsForSenders(
0 commit comments