nervosnetwork / ckb-light-client

CKB light client reference implementation
MIT License
14 stars 16 forks source link

feat: get more last headers in the first proof of a newly connected peer #178

Closed yangby-cryptape closed 7 months ago

yangby-cryptape commented 7 months ago

Description

In the following scenario:

If $t$ is very small, and P changes to another fork chain, then the fork block will be hard to find.

https://github.com/nervosnetwork/ckb-light-client/blob/0a8c34ab0db24c8d3af53a894efb1a443ea7cae4/src/protocols/light_client/mod.rs#L364-L376

As a result, it is easy to trigger "long fork detected".

Changes

codecov-commenter commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (0a8c34a) 71.42% compared to head (0c653da) 72.46%. Report is 6 commits behind head on develop.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #178 +/- ## =========================================== + Coverage 71.42% 72.46% +1.04% =========================================== Files 25 25 Lines 6512 6523 +11 =========================================== + Hits 4651 4727 +76 + Misses 1861 1796 -65 ``` | [Flag](https://app.codecov.io/gh/nervosnetwork/ckb-light-client/pull/178/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nervosnetwork) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/nervosnetwork/ckb-light-client/pull/178/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nervosnetwork) | `72.46% <100.00%> (+1.04%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nervosnetwork#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.