Skip to content

Commit

Permalink
Merge pull request #4171 from yangby-cryptape/bugfix/no-mmr-for-fork-…
Browse files Browse the repository at this point in the history
…chains

fix(light-client): could not check MMR for fork chains
  • Loading branch information
quake authored Sep 29, 2023
2 parents 922516e + f2cdacf commit 6d6b071
Showing 1 changed file with 8 additions and 3 deletions.
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

0 comments on commit 6d6b071

Please sign in to comment.