@@ -82,6 +82,7 @@ func NewWasmChainProcessor(log *zap.Logger, provider *WasmProvider, metrics *pro
82
82
83
83
var (
84
84
inSyncNumBlocksThreshold = int64 (2 )
85
+ numOffsetBlocks = int64 (2 )
85
86
)
86
87
87
88
const (
@@ -286,7 +287,7 @@ func (ccp *WasmChainProcessor) Run(ctx context.Context, initialBlockHistory uint
286
287
287
288
ccp .log .Debug ("Entering Wasm main query loop" )
288
289
if ccp .chainProvider .rangeSupport {
289
- inSyncNumBlocksThreshold = 5
290
+ inSyncNumBlocksThreshold = 10
290
291
}
291
292
ticker := time .NewTicker (persistence .minQueryLoopDuration )
292
293
defer ticker .Stop ()
@@ -372,7 +373,7 @@ func (ccp *WasmChainProcessor) getBlocksToProcess(ctx context.Context, blockToRe
372
373
defer cancelQueryCtx ()
373
374
page := int (1 )
374
375
perPage := int (50 )
375
- txsResult , err := ccp .chainProvider .RPCClient .TxSearch (queryCtx , queryFilter , true , & page , & perPage , "asc" )
376
+ txsResult , err := ccp .chainProvider .BlockRPCClient .TxSearch (queryCtx , queryFilter , true , & page , & perPage , "asc" )
376
377
var resultArr []int64
377
378
if err != nil {
378
379
return []int64 {}, err
@@ -454,7 +455,7 @@ func (ccp *WasmChainProcessor) queryCycle(ctx context.Context, persistence *quer
454
455
455
456
syncUpHeight := func () int64 {
456
457
if ccp .chainProvider .rangeSupport {
457
- return persistence .latestHeight - inSyncNumBlocksThreshold + 2
458
+ return persistence .latestHeight - numOffsetBlocks
458
459
}
459
460
if persistence .latestHeight - persistence .latestQueriedBlock > MaxBlockFetch {
460
461
return persistence .latestQueriedBlock + MaxBlockFetch
@@ -463,7 +464,8 @@ func (ccp *WasmChainProcessor) queryCycle(ctx context.Context, persistence *quer
463
464
}
464
465
var blocks []int64
465
466
heighttoSync := syncUpHeight ()
466
- if ccp .chainProvider .rangeSupport {
467
+ delta := persistence .latestHeight - persistence .latestQueriedBlock
468
+ if ccp .chainProvider .rangeSupport && delta > 20 {
467
469
if (persistence .latestQueriedBlock + 1 ) >= persistence .latestHeight {
468
470
return nil
469
471
}
@@ -578,7 +580,6 @@ func (ccp *WasmChainProcessor) queryCycle(ctx context.Context, persistence *quer
578
580
)
579
581
continue
580
582
}
581
-
582
583
pp .HandleNewData (chainID , processor.ChainProcessorCacheData {
583
584
LatestBlock : ccp .latestBlock ,
584
585
LatestHeader : latestHeader ,
0 commit comments