Skip to content

Commit

Permalink
Merge pull request #21 from ckb-cell/bugfix/reorg-failed-when-only-1-…
Browse files Browse the repository at this point in the history
…stale

fix: failed to reorg when only one stale block
  • Loading branch information
yangby-cryptape authored Apr 5, 2024
2 parents ba3f652 + 46a4814 commit fc5b5b8
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/components/spv_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,20 @@ impl SpvService {
let packed_spv_header_root = spv_header_root.pack();

if packed_stg_header_root.as_slice() == packed_spv_header_root.as_slice() {
let input = SpvReorgInput {
info,
curr: cell.clone(),
stale,
};
return Ok(input);
if stale.len() > 1 {
let input = SpvReorgInput {
info,
curr: cell.clone(),
stale,
};
return Ok(input);
} else {
log::warn!(
"[TODO::KnownIssue] this is a dirty patch to fix an issue in the contract: \
update and reorg only 1 block are indistinguishable, \
let's just reorg 1 more client"
);
}
}

log::trace!("[onchain] header#{spv_height}; mmr-root {spv_header_root}");
Expand Down

0 comments on commit fc5b5b8

Please sign in to comment.