Closed yangby-cryptape closed 8 months ago
Attention: 1 lines
in your changes are missing coverage. Please review.
Comparison is base (
fc45e35
) 71.41% compared to head (82a46db
) 71.39%.
Files | Patch % | Lines |
---|---|---|
src/protocols/light_client/peers.rs | 50.00% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Why
< self.check_point_interval * 2
?https://github.com/nervosnetwork/ckb-light-client/blob/fc45e35cd3ce40fae5762daa97e4c89991094262/src/protocols/light_client/peers.rs#L539-L541
Because light client don't finalize the latest checkpoint, light client will keep a checkpoint as a safe distance, so it doesn't have to rollback such many blocks even there is a fork. (N.B. Light client won't handle a long fork.)
check_point_interval
as $I$, light client will use the $(| \frac{N-I+1}{I}| - 1)\mathrm{-th}$ checkpoint as finalized checkpoint if there are more than $\frac{1}{2}\mathrm{MAX\_OUTBOUND\_PEERS}$ peers have this checkpoint.So, as an approximated value, I use
< self.check_point_interval * 2
here.Ref: the 2nd issue in https://github.com/nervosnetwork/ckb-light-client/issues/168#issuecomment-1871169613.