txdb: handle malformed first coin cursor key #35248

pull CruzMolina wants to merge 1 commits into bitcoin:master from CruzMolina:txdb-cursor-malformed-key changing 2 files +21 −5
  1. CruzMolina commented at 10:08 PM on May 8, 2026: none

    Motivation

    CCoinsViewDB::Cursor() caches the first coin key after seeking to the coin prefix. It checked that the underlying LevelDB iterator was valid, but ignored whether deserializing the first key succeeded.

    CCoinsViewDBCursor::Next() already treats a failed key decode as an invalid cursor. The initial cursor setup should do the same.

    Change

    Make CCoinsViewDB::Cursor() mark the cursor invalid if the first key cannot be decoded.

    Add a regression test covering a malformed first coin key.

    Test

    cmake --build build --target test_bitcoin
    build/bin/test_bitcoin --run_test=coins_tests_dbbase
    
  2. txdb: handle malformed first coin cursor key
    CCoinsViewDB::Cursor() caches the first coin key after seeking to the coin prefix. It checked that the underlying LevelDB iterator was valid, but ignored whether deserializing the key succeeded.
    
    CCoinsViewDBCursor::Next() already treats a failed key decode as an invalid cursor. Mirror that behavior during initial cursor setup so a malformed first coin key cannot leave the cursor reporting itself as valid with a stale cached key.
    
    Add a regression test for the malformed first-key case.
    309e1e1e03
  3. DrahtBot added the label UTXO Db and Indexes on May 8, 2026
  4. DrahtBot commented at 10:08 PM on May 8, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. maflcko commented at 6:46 AM on May 9, 2026: member

    ai slop: A bot re-creating previous pull requests without any reference

  6. maflcko closed this on May 9, 2026


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: 2026-05-11 12:12 UTC

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