@@ -121,8 +121,6 @@ func CreateFallbackClient(fallbackClientUrl string, fallbackClientTimeout time.D
121
121
122
122
type SyncProgressBackend interface {
123
123
SyncProgressMap () map [string ]interface {}
124
- SafeBlockNumber (ctx context.Context ) (uint64 , error )
125
- FinalizedBlockNumber (ctx context.Context ) (uint64 , error )
126
124
BlockMetadataByNumber (blockNum uint64 ) (common.BlockMetadata , error )
127
125
}
128
126
@@ -407,13 +405,23 @@ func (a *APIBackend) blockNumberToUint(ctx context.Context, number rpc.BlockNumb
407
405
if a .sync == nil {
408
406
return 0 , errors .New ("block number not supported: object not set" )
409
407
}
410
- return a .sync .SafeBlockNumber (ctx )
408
+
409
+ currentSafeBlock := a .BlockChain ().CurrentSafeBlock ()
410
+ if currentSafeBlock == nil {
411
+ return 0 , errors .New ("safe block not found" )
412
+ }
413
+ return currentSafeBlock .Number .Uint64 (), nil
411
414
}
412
415
if number == rpc .FinalizedBlockNumber {
413
416
if a .sync == nil {
414
417
return 0 , errors .New ("block number not supported: object not set" )
415
418
}
416
- return a .sync .FinalizedBlockNumber (ctx )
419
+
420
+ currentFinalizedBlock := a .BlockChain ().CurrentFinalBlock ()
421
+ if currentFinalizedBlock == nil {
422
+ return 0 , errors .New ("finalized block not found" )
423
+ }
424
+ return currentFinalizedBlock .Number .Uint64 (), nil
417
425
}
418
426
if number < 0 {
419
427
return 0 , errors .New ("block number not supported" )
0 commit comments