bench: replace CreateMockableWalletDatabase with MakeInMemoryWalletDatabase #35705

pull pablomartin4btc wants to merge 1 commits into bitcoin:master from pablomartin4btc:bench/inmemory-wallet-database changing 5 files +12 −8
  1. pablomartin4btc commented at 3:24 AM on July 13, 2026: member

    Benchmarks don't need mock-specific behaviour (overridden Filename(), Format(), or the exposed batch-level WriteKey()). Replace CreateMockableWalletDatabase() with MakeInMemoryWalletDatabase() across all 6 call sites in src/bench/ (5 files - 4 wallet bench files + 1 in coin_selection), using the same in-memory SQLite path that production code uses.

    wallet_migration.cpp is excluded: it calls GetOrCreateLegacyDataSPKM() which asserts Format() == "sqlite-mock", a deliberate signal that allows legacy SPKM setup in test/bench contexts. MockableSQLiteDatabase is still correct there.

    For coin_selection.cpp, which had no other dependencies on wallet/test/util.h, the include is switched to <wallet/sqlite.h>. The remaining 4 files retain wallet/test/util.h for other utilities but also add an explicit <wallet/sqlite.h> include as required by IWYU.

    Follow-up suggested in #35655.

  2. DrahtBot renamed this:
    bench: replace CreateMockableWalletDatabase with MakeInMemoryWalletDatabase
    bench: replace CreateMockableWalletDatabase with MakeInMemoryWalletDatabase
    on Jul 13, 2026
  3. DrahtBot added the label Tests on Jul 13, 2026
  4. DrahtBot commented at 3:24 AM on July 13, 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/35705.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK sedited, janb84

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. pablomartin4btc force-pushed on Jul 13, 2026
  6. DrahtBot added the label CI failed on Jul 13, 2026
  7. DrahtBot commented at 3:59 AM on July 13, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task iwyu: https://github.com/bitcoin/bitcoin/actions/runs/29221617518/job/86727716744</sub> <sub>LLM reason (✨ experimental): CI failed because IWYU reported missing/incorrect #include dependencies (triggering “Failure generated from IWYU”).</sub>

    <details><summary>Hints</summary>

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

    </details>

  8. bench: replace CreateMockableWalletDatabase with MakeInMemoryWalletDatabase
    Benchmarks don't need mock-specific behaviour (overridden Filename(),
    Format(), or the exposed batch-level WriteKey()). Replace
    CreateMockableWalletDatabase() with MakeInMemoryWalletDatabase() across
    6 call sites in src/bench/ (5 files), using the same in-memory SQLite
    path that production code uses.
    
    wallet_migration.cpp is excluded: it calls GetOrCreateLegacyDataSPKM()
    which asserts Format() == "sqlite-mock", a signal used to allow legacy
    SPKM setup in test/bench contexts. MockableSQLiteDatabase is still
    correct there.
    
    For coin_selection.cpp, which had no other dependencies on
    wallet/test/util.h, also switch the include to <wallet/sqlite.h>.
    
    Follow-up suggested in #35655.
    7508ac319d
  9. pablomartin4btc force-pushed on Jul 13, 2026
  10. DrahtBot removed the label CI failed on Jul 13, 2026
  11. sedited approved
  12. sedited commented at 9:18 AM on July 13, 2026: contributor

    ACK 7508ac319d992eb0a731a7b2e879bcad5859c3c4

  13. janb84 commented at 12:52 PM on July 13, 2026: contributor

    ACK 7508ac319d992eb0a731a7b2e879bcad5859c3c4

    PR removes an unnecessary test-only indirection, after #35655. LGTM

    Code review, build and checked if this has any consequences for benchmarking (all within variance)

    <details>

    This PR:

    |        ns/selection |         selection/s |    err% |     total | benchmark
    |--------------------:|--------------------:|--------:|----------:|:----------
    |        4,188,525.00 |              238.75 |    0.1% |      0.46 | `CoinSelection`
    
    |               ns/op |                op/s |    err% |     total | benchmark
    |--------------------:|--------------------:|--------:|----------:|:----------
    |       35,623,583.00 |               28.07 |    0.0% |      0.39 | `WalletAvailableCoins`
    |            3,083.00 |          324,359.39 |    1.3% |      0.00 | `WalletBalanceClean`
    |            3,125.00 |          320,000.00 |    0.0% |      0.00 | `WalletBalanceDirty`
    |               41.00 |       24,390,243.90 |    2.4% |      0.00 | `WalletBalanceWatch`
    |          807,584.00 |            1,238.26 |    0.4% |      0.01 | `WalletCreateTxUseOnlyPresetInputs`
    |       21,648,458.00 |               46.19 |    1.8% |      0.24 | `WalletCreateTxUsePresetInputsAndCoinSelection`
    
    |              ns/key |               key/s |    err% |     total | benchmark
    |--------------------:|--------------------:|--------:|----------:|:----------
    |          199,289.15 |            5,017.83 |    0.3% |      4.39 | `WalletEncryptDescriptors`
    
    |               ns/op |                op/s |    err% |     total | benchmark
    |--------------------:|--------------------:|--------:|----------:|:----------
    |               37.46 |       26,692,554.06 |    0.2% |      0.01 | `WalletIsMineDescriptors`
    |               37.86 |       26,411,598.60 |    0.3% |      0.01 | `WalletIsMineMigratedDescriptors`
    

    Master:

    |        ns/selection |         selection/s |    err% |     total | benchmark
    |--------------------:|--------------------:|--------:|----------:|:----------
    |        4,128,975.00 |              242.19 |    0.2% |      0.45 | `CoinSelection`
    
    |               ns/op |                op/s |    err% |     total | benchmark
    |--------------------:|--------------------:|--------:|----------:|:----------
    |       35,544,333.00 |               28.13 |    0.1% |      0.39 | `WalletAvailableCoins`
    |            3,083.00 |          324,359.39 |    1.3% |      0.00 | `WalletBalanceClean`
    |            3,166.00 |          315,855.97 |    1.3% |      0.00 | `WalletBalanceDirty`
    |               41.00 |       24,390,243.90 |    2.4% |      0.00 | `WalletBalanceWatch`
    |          729,834.00 |            1,370.17 |    0.3% |      0.01 | `WalletCreateTxUseOnlyPresetInputs`
    |       21,700,541.00 |               46.08 |    1.7% |      0.24 | `WalletCreateTxUsePresetInputsAndCoinSelection`
    
    |              ns/key |               key/s |    err% |     total | benchmark
    |--------------------:|--------------------:|--------:|----------:|:----------
    |          198,431.87 |            5,039.51 |    0.2% |      4.37 | `WalletEncryptDescriptors`
    
    |               ns/op |                op/s |    err% |     total | benchmark
    |--------------------:|--------------------:|--------:|----------:|:----------
    |               36.81 |       27,168,938.22 |    0.1% |      0.01 | `WalletIsMineDescriptors`
    |               37.38 |       26,750,031.75 |    0.4% |      0.01 | `WalletIsMineMigratedDescriptors`
    

    </details>

  14. sedited merged this on Jul 13, 2026
  15. sedited closed this on Jul 13, 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-07-16 07:51 UTC

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