Closed yangby-cryptape closed 7 months ago
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.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Description
In the following scenario:
LAST_N_BLOCKS
.L
is shutdown with last state $s$.L
, and it connects to a peerP
whose tip is $s+t$ and $t < N$. So, the first proof thatL
received fromP
, will contains only $t$ last headers.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