fix: stuck after restart when min filtered block is previous block of a check point #162
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
In the following code:
ckb-light-client/src/protocols/light_client/peers.rs
Lines 1606 to 1608 in 38aa9b2
min_filtered_block_number
is the last filtered block which has been synchronized.should_cached_check_point_index
is the index of the check point, which contains the next filtered block which will be synchronized.So, the it should be fixed with following patch:
See the following code:
ckb-light-client/src/protocols/light_client/peers.rs
Lines 1141 to 1143 in 38aa9b2
At start, the check point index and the block number of it is
0, 0
.The following check point index and the block number of it are
1, 2000
,2, 4000
and son on.When the client want to synchronizes the block
2000
,the last check point should be0
.When the client want to synchronizes the block
2001
to4000
,the last check point should be1
.So, when client synchronizes the filtered block
number
, the check point should be:Changed some naming to make the names are more appropriate.