@@ -69,10 +69,9 @@ impl rpc_server::Rpc for StoreApi {
6969 // Validate nullifier prefix list size before querying state.
7070 check :: < QueryParamNullifierPrefixLimit > ( request. nullifiers . len ( ) ) ?;
7171
72- let chain_tip = self . state . chain_tip ( Finality :: Committed ) . await ;
7372 let block_range =
7473 read_block_range :: < SyncNullifiersError > ( request. block_range , "SyncNullifiersRequest" ) ?
75- . into_inclusive_range :: < SyncNullifiersError > ( & chain_tip ) ?;
74+ . into_inclusive_range :: < SyncNullifiersError > ( ) ?;
7675
7776 let ( nullifiers, block_num) = self
7877 . state
@@ -88,6 +87,8 @@ impl rpc_server::Rpc for StoreApi {
8887 } )
8988 . collect ( ) ;
9089
90+ let chain_tip = self . state . chain_tip ( Finality :: Committed ) . await ;
91+
9192 Ok ( Response :: new ( proto:: rpc:: SyncNullifiersResponse {
9293 pagination_info : Some ( proto:: rpc:: PaginationInfo {
9394 chain_tip : chain_tip. as_u32 ( ) ,
@@ -104,10 +105,11 @@ impl rpc_server::Rpc for StoreApi {
104105 ) -> Result < Response < proto:: rpc:: SyncNotesResponse > , Status > {
105106 let request = request. into_inner ( ) ;
106107
107- let chain_tip = self . state . chain_tip ( Finality :: Committed ) . await ;
108108 let block_range =
109109 read_block_range :: < NoteSyncError > ( request. block_range , "SyncNotesRequest" ) ?
110- . into_inclusive_range :: < NoteSyncError > ( & chain_tip) ?;
110+ . into_inclusive_range :: < NoteSyncError > ( ) ?;
111+
112+ let chain_tip = self . state . chain_tip ( Finality :: Committed ) . await ;
111113 if * block_range. end ( ) > chain_tip {
112114 Err ( NoteSyncError :: FutureBlock { chain_tip, block_to : * block_range. end ( ) } ) ?;
113115 }
@@ -171,7 +173,7 @@ impl rpc_server::Rpc for StoreApi {
171173 Ok ( Response :: new ( proto:: rpc:: SyncChainMmrResponse {
172174 block_range : Some ( proto:: rpc:: BlockRange {
173175 block_from : block_range. start ( ) . as_u32 ( ) ,
174- block_to : Some ( block_range. end ( ) . as_u32 ( ) ) ,
176+ block_to : block_range. end ( ) . as_u32 ( ) ,
175177 } ) ,
176178 mmr_delta : Some ( mmr_delta. into ( ) ) ,
177179 block_header : Some ( block_header. into ( ) ) ,
@@ -249,7 +251,6 @@ impl rpc_server::Rpc for StoreApi {
249251 request : Request < proto:: rpc:: SyncAccountVaultRequest > ,
250252 ) -> Result < Response < proto:: rpc:: SyncAccountVaultResponse > , Status > {
251253 let request = request. into_inner ( ) ;
252- let chain_tip = self . state . chain_tip ( Finality :: Committed ) . await ;
253254
254255 let account_id: AccountId = read_account_id :: <
255256 proto:: rpc:: SyncAccountVaultRequest ,
@@ -264,7 +265,7 @@ impl rpc_server::Rpc for StoreApi {
264265 request. block_range ,
265266 "SyncAccountVaultRequest" ,
266267 ) ?
267- . into_inclusive_range :: < SyncAccountVaultError > ( & chain_tip ) ?;
268+ . into_inclusive_range :: < SyncAccountVaultError > ( ) ?;
268269
269270 let ( last_included_block, updates) = self
270271 . state
@@ -284,6 +285,8 @@ impl rpc_server::Rpc for StoreApi {
284285 } )
285286 . collect ( ) ;
286287
288+ let chain_tip = self . state . chain_tip ( Finality :: Committed ) . await ;
289+
287290 Ok ( Response :: new ( proto:: rpc:: SyncAccountVaultResponse {
288291 pagination_info : Some ( proto:: rpc:: PaginationInfo {
289292 chain_tip : chain_tip. as_u32 ( ) ,
@@ -311,12 +314,11 @@ impl rpc_server::Rpc for StoreApi {
311314 Err ( SyncAccountStorageMapsError :: AccountNotPublic ( account_id) ) ?;
312315 }
313316
314- let chain_tip = self . state . chain_tip ( Finality :: Committed ) . await ;
315317 let block_range = read_block_range :: < SyncAccountStorageMapsError > (
316318 request. block_range ,
317319 "SyncAccountStorageMapsRequest" ,
318320 ) ?
319- . into_inclusive_range :: < SyncAccountStorageMapsError > ( & chain_tip ) ?;
321+ . into_inclusive_range :: < SyncAccountStorageMapsError > ( ) ?;
320322
321323 let storage_maps_page = self
322324 . state
@@ -335,6 +337,8 @@ impl rpc_server::Rpc for StoreApi {
335337 } )
336338 . collect ( ) ;
337339
340+ let chain_tip = self . state . chain_tip ( Finality :: Committed ) . await ;
341+
338342 Ok ( Response :: new ( proto:: rpc:: SyncAccountStorageMapsResponse {
339343 pagination_info : Some ( proto:: rpc:: PaginationInfo {
340344 chain_tip : chain_tip. as_u32 ( ) ,
@@ -383,12 +387,11 @@ impl rpc_server::Rpc for StoreApi {
383387
384388 let request = request. into_inner ( ) ;
385389
386- let chain_tip = self . state . chain_tip ( Finality :: Committed ) . await ;
387390 let block_range = read_block_range :: < SyncTransactionsError > (
388391 request. block_range ,
389392 "SyncTransactionsRequest" ,
390393 ) ?
391- . into_inclusive_range :: < SyncTransactionsError > ( & chain_tip ) ?;
394+ . into_inclusive_range :: < SyncTransactionsError > ( ) ?;
392395
393396 let account_ids: Vec < AccountId > =
394397 read_account_ids :: < SyncTransactionsError , _ > ( request. account_ids ) ?;
@@ -409,6 +412,8 @@ impl rpc_server::Rpc for StoreApi {
409412 . map ( crate :: db:: TransactionRecord :: into_proto)
410413 . collect ( ) ;
411414
415+ let chain_tip = self . state . chain_tip ( Finality :: Committed ) . await ;
416+
412417 Ok ( Response :: new ( proto:: rpc:: SyncTransactionsResponse {
413418 pagination_info : Some ( proto:: rpc:: PaginationInfo {
414419 chain_tip : chain_tip. as_u32 ( ) ,
0 commit comments