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: remove check partial_chain_work when reorg #31

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion checksums.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
6bbea4820329050e1fc65f9c15cab5948b824c73aa3430d7d92b793c53ca66b6 build/release/can-update-without-ownership-lock
eaa9e3aeb1205e611078a819e960c33f4934ea49029aab3445a241955e696ee1 build/release/ckb-bitcoin-spv-type-lock
cfa7d777f246ebd037af156db73c6c7eab3e8e4e1f6e15783a68d2a164875032 build/release/ckb-bitcoin-spv-type-lock
20 changes: 12 additions & 8 deletions contracts/ckb-bitcoin-spv-type-lock/src/operations/reorg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub(crate) fn reorg_clients(inputs: &[usize], outputs: &[usize], script_hash: &[
expected_info,
expected_tip_client_id,
expected_client_ids,
previous_chain_work,
_previous_chain_work,
fork_client_id,
flags,
) = {
Expand All @@ -53,13 +53,17 @@ pub(crate) fn reorg_clients(inputs: &[usize], outputs: &[usize], script_hash: &[
let (output_client, output_info_index) =
load_outputs(outputs, &expected_info, expected_client_ids)?;
{
let new_chain_work: U256 = output_client
.headers_mmr_root()
.partial_chain_work()
.unpack();
if previous_chain_work >= new_chain_work {
return Err(InternalError::ReorgNotBetterChain.into());
}
// If there is a limit on the number of headers to update
jjyr marked this conversation as resolved.
Show resolved Hide resolved
// it may cause the current work to be insufficient, but still on the main chain
// so here we no longer check the chain work

// let new_chain_work: U256 = output_client
// .headers_mmr_root()
// .partial_chain_work()
// .unpack();
// if previous_chain_work >= new_chain_work {
// return Err(InternalError::ReorgNotBetterChain.into());
// }
}
// Finds the only one index of cell deps which use current script.
// That cell should be the client which at the fork point.
Expand Down
Loading