leveldb: correct trailer boundary check in Reader::SkipToInitialBlock #33955

pull sashass1315 wants to merge 1 commits into bitcoin:master from sashass1315:fix/log-reader-trailer-boundary changing 1 files +1 −1
  1. sashass1315 commented at 7:13 pm on November 26, 2025: none
    replaces the magic number 6 in the trailer boundary condition with kHeaderSize and corrects an off-by-one by expressing the rule as offset_in_block > kBlockSize - kHeaderSize, which is equivalent to offset_in_block >= kBlockSize - 6. According to src/leveldb/doc/log_format.md: “A record never starts within the last six bytes of a block” and when exactly seven bytes remain a record may start (e.g., a zero-length FIRST), so the equal case must be treated as trailer. The writer already uses kHeaderSize to manage trailers, and aligning the reader with kHeaderSize removes a format-coupled magic number and ensures future-proof consistency. Functionally this avoids scanning a block when initial_offset_ is in the last six bytes, matching the documented format; it was previously a minor inefficiency and comment mismatch rather than a correctness issue.
  2. leveldb: correct trailer boundary check in Reader::SkipToInitialBlock 91faa93c17
  3. DrahtBot commented at 7:13 pm on November 26, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33955.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

  4. maflcko commented at 8:03 am on November 27, 2025: member
    thx, but this will need to go upstream
  5. maflcko closed this on Nov 27, 2025


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-12-01 21:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me