@@ -18,7 +18,7 @@ use solana_client::{
1818 RpcSimulateTransactionResult ,
1919 } ,
2020} ;
21- use solana_clock:: { Slot , UnixTimestamp } ;
21+ use solana_clock:: { Slot , UnixTimestamp , MAX_RECENT_BLOCKHASHES } ;
2222use solana_commitment_config:: { CommitmentConfig , CommitmentLevel } ;
2323use solana_message:: VersionedMessage ;
2424use solana_pubkey:: Pubkey ;
@@ -2050,7 +2050,8 @@ impl Full for SurfpoolFullRpc {
20502050 _config : Option < RpcContextConfig > ,
20512051 ) -> Result < RpcResponse < RpcBlockhash > > {
20522052 meta. with_svm_reader ( |svm_reader| {
2053- let last_valid_block_height = svm_reader. latest_epoch_info . block_height ;
2053+ let last_valid_block_height =
2054+ svm_reader. latest_epoch_info . block_height + MAX_RECENT_BLOCKHASHES as u64 ;
20542055 let value = RpcBlockhash {
20552056 blockhash : svm_reader. latest_blockhash ( ) . to_string ( ) ,
20562057 last_valid_block_height,
@@ -3053,16 +3054,28 @@ mod tests {
30533054 . rpc
30543055 . get_latest_blockhash ( Some ( setup. context . clone ( ) ) , None )
30553056 . unwrap ( ) ;
3056-
3057+ let expected_blockhash = setup
3058+ . context
3059+ . svm_locker
3060+ . 0
3061+ . blocking_read ( )
3062+ . latest_blockhash ( ) ;
3063+ let expected_last_valid_block_height = setup
3064+ . context
3065+ . svm_locker
3066+ . 0
3067+ . blocking_read ( )
3068+ . latest_epoch_info
3069+ . block_height
3070+ + MAX_RECENT_BLOCKHASHES as u64 ;
30573071 assert_eq ! (
30583072 res. value. blockhash,
3059- setup
3060- . context
3061- . svm_locker
3062- . 0
3063- . blocking_read( )
3064- . latest_blockhash( )
3065- . to_string( )
3073+ expected_blockhash. to_string( ) ,
3074+ "Latest blockhash does not match expected value"
3075+ ) ;
3076+ assert_eq ! (
3077+ res. value. last_valid_block_height, expected_last_valid_block_height,
3078+ "Last valid block height does not match expected value"
30663079 ) ;
30673080 }
30683081
0 commit comments