Skip to content

Commit 1c145a4

Browse files
committed
fix reorg: remove check partial_chain_work.
1 parent 5125606 commit 1c145a4

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

checksums.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
6bbea4820329050e1fc65f9c15cab5948b824c73aa3430d7d92b793c53ca66b6 build/release/can-update-without-ownership-lock
2-
eaa9e3aeb1205e611078a819e960c33f4934ea49029aab3445a241955e696ee1 build/release/ckb-bitcoin-spv-type-lock
2+
cfa7d777f246ebd037af156db73c6c7eab3e8e4e1f6e15783a68d2a164875032 build/release/ckb-bitcoin-spv-type-lock

contracts/ckb-bitcoin-spv-type-lock/src/operations/reorg.rs

+12-8
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub(crate) fn reorg_clients(inputs: &[usize], outputs: &[usize], script_hash: &[
2626
expected_info,
2727
expected_tip_client_id,
2828
expected_client_ids,
29-
previous_chain_work,
29+
_previous_chain_work,
3030
fork_client_id,
3131
flags,
3232
) = {
@@ -53,13 +53,17 @@ pub(crate) fn reorg_clients(inputs: &[usize], outputs: &[usize], script_hash: &[
5353
let (output_client, output_info_index) =
5454
load_outputs(outputs, &expected_info, expected_client_ids)?;
5555
{
56-
let new_chain_work: U256 = output_client
57-
.headers_mmr_root()
58-
.partial_chain_work()
59-
.unpack();
60-
if previous_chain_work >= new_chain_work {
61-
return Err(InternalError::ReorgNotBetterChain.into());
62-
}
56+
// If there is a limit on the number of headers to update
57+
// it may cause the current work to be insufficient, but still on the main chain
58+
// so here we no longer check the chain work
59+
60+
// let new_chain_work: U256 = output_client
61+
// .headers_mmr_root()
62+
// .partial_chain_work()
63+
// .unpack();
64+
// if previous_chain_work >= new_chain_work {
65+
// return Err(InternalError::ReorgNotBetterChain.into());
66+
// }
6367
}
6468
// Finds the only one index of cell deps which use current script.
6569
// That cell should be the client which at the fork point.

0 commit comments

Comments
 (0)