@@ -224,8 +224,6 @@ impl ReceiptRead<TapReceipt> for TapAgentContext<Horizon> {
224224 error : format ! ( "{e:?}." ) ,
225225 } ) ?;
226226
227- // TODO filter by data_service when we have multiple data services
228-
229227 let records = sqlx:: query!(
230228 r#"
231229 SELECT
@@ -242,15 +240,17 @@ impl ReceiptRead<TapReceipt> for TapAgentContext<Horizon> {
242240 WHERE
243241 collection_id = $1
244242 AND payer = $2
245- AND service_provider = $3
246- AND signer_address IN (SELECT unnest($4::text[]))
247- AND $5::numrange @> timestamp_ns
243+ AND data_service = $3
244+ AND service_provider = $4
245+ AND signer_address IN (SELECT unnest($5::text[]))
246+ AND $6::numrange @> timestamp_ns
248247 ORDER BY timestamp_ns ASC
249- LIMIT $6
248+ LIMIT $7
250249 "# ,
251250 CollectionId :: from( self . allocation_id) . encode_hex( ) ,
252251 self . sender. encode_hex( ) ,
253252 self . indexer_address. encode_hex( ) ,
253+ self . indexer_address. encode_hex( ) ,
254254 & signers,
255255 rangebounds_to_pgrange( timestamp_range_ns) ,
256256 ( receipts_limit + 1 ) as i64 ,
@@ -364,13 +364,15 @@ impl ReceiptDelete for TapAgentContext<Horizon> {
364364 AND signer_address IN (SELECT unnest($2::text[]))
365365 AND $3::numrange @> timestamp_ns
366366 AND payer = $4
367- AND service_provider = $5
367+ AND data_service = $5
368+ AND service_provider = $6
368369 "# ,
369370 CollectionId :: from( self . allocation_id) . encode_hex( ) ,
370371 & signers,
371372 rangebounds_to_pgrange( timestamp_ns) ,
372373 self . sender. encode_hex( ) ,
373374 self . indexer_address. encode_hex( ) ,
375+ self . indexer_address. encode_hex( ) ,
374376 )
375377 . execute ( & self . pgpool )
376378 . await ?;
0 commit comments