File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed
crates/rpc/rpc-eth-impl/src Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -92,15 +92,21 @@ impl EthApi {
9292 None ,
9393 false ,
9494 ) ?
95- . ok_or ( "Specified block header does not exist" . into ( ) )
95+ . ok_or (
96+ format ! ( "Specified block does not exist, height={}" , height)
97+ . into ( ) ,
98+ )
9699 }
97100
98101 pub fn fetch_block_by_hash (
99102 & self , hash : & H256 ,
100103 ) -> Result < PhantomBlock , ProviderBlockError > {
101104 self . consensus_graph ( )
102105 . get_phantom_block_by_hash ( hash, false ) ?
103- . ok_or ( "Specified block header does not exist" . into ( ) )
106+ . ok_or (
107+ format ! ( "Specified block does not exist, hash={:?}" , hash)
108+ . into ( ) ,
109+ )
104110 }
105111
106112 fn convert_block_number_to_epoch_number (
@@ -837,13 +843,20 @@ impl EthApi {
837843 }
838844 }
839845
840- let block = self
841- . fetch_block_by_height ( end_block + 1 )
842- . map_err ( RpcError :: invalid_params) ?;
846+ let last_hash = self
847+ . consensus_graph ( )
848+ . get_hash_from_epoch_number ( ( end_block + 1 ) . into ( ) ) ?;
849+ let last_header = self
850+ . consensus_graph ( )
851+ . data_manager ( )
852+ . block_header_by_hash ( & last_hash)
853+ . ok_or_else ( || {
854+ format ! ( "last block missing, height={}" , end_block + 1 )
855+ } ) ?;
843856
844857 fee_history. finish (
845858 start_block,
846- block . pivot_header . base_price ( ) . as_ref ( ) ,
859+ last_header . base_price ( ) . as_ref ( ) ,
847860 Space :: Ethereum ,
848861 ) ;
849862
You can’t perform that action at this time.
0 commit comments