@@ -3,7 +3,7 @@ use anyhow::{Context, Error};
3
3
use graph:: blockchain:: client:: ChainClient ;
4
4
use graph:: blockchain:: firehose_block_ingestor:: { FirehoseBlockIngestor , Transforms } ;
5
5
use graph:: blockchain:: { BlockIngestor , BlockchainKind , TriggersAdapterSelector } ;
6
- use graph:: components:: store:: WritableStore ;
6
+ use graph:: components:: store:: StoreStateTracker ;
7
7
use graph:: data:: subgraph:: UnifiedMappingApiVersion ;
8
8
use graph:: firehose:: { FirehoseEndpoint , ForkStep } ;
9
9
use graph:: prelude:: {
@@ -349,39 +349,43 @@ impl Blockchain for Chain {
349
349
self . adapter_selector
350
350
. triggers_adapter ( loc, capabilities, unified_api_version)
351
351
}
352
+
352
353
async fn new_block_stream (
353
354
& self ,
354
355
deployment : DeploymentLocator ,
355
- store : Arc < dyn WritableStore > ,
356
+ store : impl StoreStateTracker ,
356
357
start_blocks : Vec < BlockNumber > ,
357
358
filter : Arc < Self :: TriggerFilter > ,
358
359
unified_api_version : UnifiedMappingApiVersion ,
359
360
) -> Result < Box < dyn BlockStream < Self > > , Error > {
360
361
let current_ptr = store. block_ptr ( ) ;
361
- if !self . chain_client ( ) . is_firehose ( ) {
362
- return self
363
- . block_stream_builder
364
- . build_polling (
365
- self ,
366
- deployment,
367
- start_blocks,
368
- current_ptr,
369
- filter,
370
- unified_api_version,
371
- )
372
- . await ;
362
+ match self . chain_client ( ) . as_ref ( ) {
363
+ ChainClient :: Rpc ( _) => {
364
+ self . block_stream_builder
365
+ . build_polling (
366
+ self ,
367
+ deployment,
368
+ start_blocks,
369
+ current_ptr,
370
+ filter,
371
+ unified_api_version,
372
+ )
373
+ . await
374
+ }
375
+ ChainClient :: Firehose ( _) => {
376
+ self . block_stream_builder
377
+ . build_firehose (
378
+ self ,
379
+ deployment,
380
+ store. block_cursor ( ) ,
381
+ start_blocks,
382
+ current_ptr,
383
+ filter,
384
+ unified_api_version,
385
+ )
386
+ . await
387
+ }
373
388
}
374
- self . block_stream_builder
375
- . build_firehose (
376
- self ,
377
- deployment,
378
- store. block_cursor ( ) ,
379
- start_blocks,
380
- current_ptr,
381
- filter,
382
- unified_api_version,
383
- )
384
- . await
385
389
}
386
390
387
391
fn chain_store ( & self ) -> Arc < dyn ChainStore > {
0 commit comments