@@ -251,34 +251,34 @@ impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> Chainstat
251251 #[ log_error]
252252 pub fn get_block_id_by_height (
253253 & self ,
254- height : & BlockHeight ,
254+ height : BlockHeight ,
255255 ) -> Result < Option < Id < GenBlock > > , PropertyQueryError > {
256256 self . db_tx . get_block_id_by_height ( height) . map_err ( PropertyQueryError :: from)
257257 }
258258
259259 #[ log_error]
260260 pub fn get_existing_block_id_by_height (
261261 & self ,
262- height : & BlockHeight ,
262+ height : BlockHeight ,
263263 ) -> Result < Id < GenBlock > , PropertyQueryError > {
264264 self . get_block_id_by_height ( height) ?
265- . ok_or ( PropertyQueryError :: BlockForHeightNotFound ( * height) )
265+ . ok_or ( PropertyQueryError :: BlockForHeightNotFound ( height) )
266266 }
267267
268268 #[ log_error]
269- pub fn get_block ( & self , block_id : Id < Block > ) -> Result < Option < Block > , PropertyQueryError > {
269+ pub fn get_block ( & self , block_id : & Id < Block > ) -> Result < Option < Block > , PropertyQueryError > {
270270 self . db_tx . get_block ( block_id) . map_err ( PropertyQueryError :: from)
271271 }
272272
273273 #[ log_error]
274- pub fn block_exists ( & self , block_id : Id < Block > ) -> Result < bool , PropertyQueryError > {
274+ pub fn block_exists ( & self , block_id : & Id < Block > ) -> Result < bool , PropertyQueryError > {
275275 self . db_tx . block_exists ( block_id) . map_err ( PropertyQueryError :: from)
276276 }
277277
278278 #[ log_error]
279279 pub fn get_block_header (
280280 & self ,
281- block_id : Id < Block > ,
281+ block_id : & Id < Block > ,
282282 ) -> Result < Option < SignedBlockHeader > , PropertyQueryError > {
283283 Ok ( self . db_tx . get_block_header ( block_id) ?)
284284 }
@@ -383,7 +383,7 @@ impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> Chainstat
383383 #[ log_error]
384384 pub fn get_header_from_height (
385385 & self ,
386- height : & BlockHeight ,
386+ height : BlockHeight ,
387387 ) -> Result < Option < SignedBlockHeader > , PropertyQueryError > {
388388 let id = self . get_existing_block_id_by_height ( height) ?;
389389 let id = id
@@ -413,7 +413,7 @@ impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> Chainstat
413413 #[ log_error]
414414 pub fn get_account_nonce_count (
415415 & self ,
416- account : AccountType ,
416+ account : & AccountType ,
417417 ) -> Result < Option < AccountNonce > , PropertyQueryError > {
418418 self . db_tx . get_account_nonce_count ( account) . map_err ( PropertyQueryError :: from)
419419 }
@@ -430,7 +430,7 @@ impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> Chainstat
430430 } ;
431431
432432 if let Some ( block_index) = self . get_block_index ( & id) ? {
433- let mainchain_block_id = self . get_block_id_by_height ( & block_index. block_height ( ) ) ?;
433+ let mainchain_block_id = self . get_block_id_by_height ( block_index. block_height ( ) ) ?;
434434
435435 // Note: this function may be called when the chain is still empty, so we don't unwrap
436436 // mainchain_block_id and wrap gen_id instead.
@@ -887,7 +887,7 @@ impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> Chainstat
887887 & self ,
888888 block_index : & BlockIndex ,
889889 ) -> Result < Option < Block > , chainstate_storage:: Error > {
890- self . db_tx . get_block ( * block_index. block_id ( ) )
890+ self . db_tx . get_block ( block_index. block_id ( ) )
891891 }
892892
893893 #[ log_error]
@@ -958,7 +958,7 @@ impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> Chainstat
958958 let id_from_height = |block_height : u64 | -> Result < Id < Block > , PropertyQueryError > {
959959 let block_height: BlockHeight = block_height. into ( ) ;
960960 let block_id = self
961- . get_block_id_by_height ( & block_height) ?
961+ . get_block_id_by_height ( block_height) ?
962962 . expect ( "Since block_height is >= best_height, this must exist" ) ;
963963 let block_id = block_id
964964 . classify ( self . chain_config )
@@ -1129,7 +1129,7 @@ impl<'a, S: BlockchainStorageRead, V: TransactionVerificationStrategy> Chainstat
11291129 } ;
11301130
11311131 let lowest_block_id = self
1132- . get_existing_block_id_by_height ( & min_height)
1132+ . get_existing_block_id_by_height ( min_height)
11331133 . map_err ( BlockError :: PropertyQueryError ) ?;
11341134
11351135 self . disconnect_tip_in_memory_until (
@@ -1340,7 +1340,7 @@ impl<S: BlockchainStorageWrite, V: TransactionVerificationStrategy> ChainstateRe
13401340 self . connect_transactions ( block_index, & block) ?;
13411341
13421342 self . db_tx . set_block_id_at_height (
1343- & block_index. block_height ( ) ,
1343+ block_index. block_height ( ) ,
13441344 & ( * block_index. block_id ( ) ) . into ( ) ,
13451345 ) ?;
13461346 self . db_tx . set_best_block_id ( & ( * block_index. block_id ( ) ) . into ( ) ) ?;
@@ -1384,7 +1384,7 @@ impl<S: BlockchainStorageWrite, V: TransactionVerificationStrategy> ChainstateRe
13841384 self . disconnect_transactions ( & block. into ( ) ) ?;
13851385 self . db_tx . set_best_block_id ( block_index. prev_block_id ( ) ) ?;
13861386 // Disconnect block
1387- self . db_tx . del_block_id_at_height ( & block_index. block_height ( ) ) ?;
1387+ self . db_tx . del_block_id_at_height ( block_index. block_height ( ) ) ?;
13881388
13891389 let prev_block_index = self
13901390 . get_previous_block_index ( & block_index)
@@ -1415,7 +1415,7 @@ impl<S: BlockchainStorageWrite, V: TransactionVerificationStrategy> ChainstateRe
14151415
14161416 #[ log_error]
14171417 pub fn persist_block ( & mut self , block : & WithId < Block > ) -> Result < ( ) , BlockError > {
1418- if self . db_tx . block_exists ( block. get_id ( ) ) . map_err ( BlockError :: from) ? {
1418+ if self . db_tx . block_exists ( & block. get_id ( ) ) . map_err ( BlockError :: from) ? {
14191419 return Err ( BlockError :: BlockAlreadyExists ( block. get_id ( ) ) ) ;
14201420 }
14211421
@@ -1450,7 +1450,7 @@ impl<S: BlockchainStorageWrite, V: TransactionVerificationStrategy> ChainstateRe
14501450 "Trying to delete a block index for a persisted block {block_id}"
14511451 ) ;
14521452
1453- self . db_tx . del_block_index ( * block_id) ?;
1453+ self . db_tx . del_block_index ( block_id) ?;
14541454 }
14551455 Ok ( ( ) )
14561456 }
0 commit comments