File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
util/light-client-protocol-server/src/components Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -204,12 +204,17 @@ impl<'a> GetLastStateProofProcess<'a> {
204
204
let snapshot = self . protocol . shared . snapshot ( ) ;
205
205
206
206
let last_block_hash = self . message . last_hash ( ) . to_entity ( ) ;
207
- let last_block = if let Some ( block) = snapshot. get_block ( & last_block_hash) {
208
- block
209
- } else {
207
+ let last_block = if !snapshot. is_main_chain ( & last_block_hash) {
210
208
return self
211
209
. protocol
212
210
. reply_tip_state :: < packed:: SendLastStateProof > ( self . peer , self . nc ) ;
211
+ } else if let Some ( block) = snapshot. get_block ( & last_block_hash) {
212
+ block
213
+ } else {
214
+ let errmsg = format ! (
215
+ "the block is in the main chain but not found, its hash is {last_block_hash:#x}"
216
+ ) ;
217
+ return StatusCode :: InternalError . with_context ( errmsg) ;
213
218
} ;
214
219
215
220
let start_block_hash = self . message . start_hash ( ) . to_entity ( ) ;
You can’t perform that action at this time.
0 commit comments