Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(light-client): could not check MMR for fork chains #4171

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,17 @@ impl<'a> GetLastStateProofProcess<'a> {
let snapshot = self.protocol.shared.snapshot();

let last_block_hash = self.message.last_hash().to_entity();
let last_block = if let Some(block) = snapshot.get_block(&last_block_hash) {
block
} else {
let last_block = if !snapshot.is_main_chain(&last_block_hash) {
return self
.protocol
.reply_tip_state::<packed::SendLastStateProof>(self.peer, self.nc);
} else if let Some(block) = snapshot.get_block(&last_block_hash) {
block
} else {
let errmsg = format!(
"the block is in the main chain but not found, its hash is {last_block_hash:#x}"
);
return StatusCode::InternalError.with_context(errmsg);
};

let start_block_hash = self.message.start_hash().to_entity();
Expand Down