Skip to content

[30.x] Backports - #35232

Merged
fanquake merged 8 commits into
bitcoin:30.xfrom
fanquake:more_30_x_backportss
Jun 3, 2026
Merged

fanquake merged 8 commits into
bitcoin:30.xfrom
fanquake:more_30_x_backportss

Conversation

@fanquake fanquake added this to the 30.3 milestone May 7, 2026
@DrahtBot

DrahtBot commented May 7, 2026 •

Copy link
Copy Markdown
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/35232.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK marcofleon, andrewtoth, willcl-ark

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

LLM Linter (✨ experimental)

Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

  • MaxInputWeight(*desc, CTxIn{outpoint}, coin_control, true, can_grind_r) in src/wallet/spend.cpp

2026-06-02 08:26:43

The FreeBSD, NetBSD, and OpenBSD build guides state that ZMQ support is compiled in when the package is installed. Since WITH_ZMQ defaults to OFF, update the wording to mention the required CMake option.

Github-Pull: bitcoin#35283
Rebased-From: ca93ab8
`CalculateMaximumSignedInputSize()` is passed the outpoint being sized, but that context was not used when estimating the signed input size.
Pass the outpoint through so externally selected inputs are not underestimated.

Co-authored-by: Antoine Poinsot <[email protected]>

Github-Pull: bitcoin#35228
Rebased-From: cd8d3bd
@fanquake
fanquake force-pushed the more_30_x_backportss branch from 6de9e2f to 6ad2e56 Compare May 20, 2026 14:37
@fanquake
fanquake force-pushed the more_30_x_backportss branch from 6ad2e56 to 2e4f087 Compare May 28, 2026 14:09
@fanquake fanquake mentioned this pull request May 28, 2026
@fanquake
fanquake force-pushed the more_30_x_backportss branch from 2e4f087 to 91a8fee Compare May 29, 2026 08:22
@fanquake
fanquake force-pushed the more_30_x_backportss branch from 91a8fee to 3ca4d94 Compare May 29, 2026 14:40
@fanquake fanquake mentioned this pull request May 29, 2026
@fanquake
fanquake marked this pull request as ready for review May 29, 2026 14:41

@willcl-ark willcl-ark left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one miss in test-each-commit that I can see. Everythign else looks ok.

leveldb is missing the usual Github-Pull or Rebased-From, but that's because it was a cherry-pick. the content appears correct

Comment thread .github/workflows/ci.yml Resolved
@fanquake
fanquake force-pushed the more_30_x_backportss branch from 3ca4d94 to cdd7c79 Compare May 29, 2026 15:24

@willcl-ark willcl-ark left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK cdd7c79225965e68f7a5764dd0599f5f68a89094

Failing lint is expected here from a subtree cherry-pick (and not entire pull)

@andrewtoth andrewtoth mentioned this pull request Jun 2, 2026

@andrewtoth andrewtoth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK cdd7c79225965e68f7a5764dd0599f5f68a89094

leveldb is missing the usual Github-Pull or Rebased-From, but that's because it was a cherry-pick. the content appears correct

This could still be added even if it's a cherry-pick though right?

andrewtoth and others added 5 commits June 2, 2026 09:25
Seek compaction is causing a cascade effect in the chainstate DB, causing large parts of the database to be rewritten every ~hour.

Every periodic flush writes around 2 MiB. Since this is roughly the `write_buffer_size`, these writes regularly cause the memtable to rotate into a small L0 file. This file has a small seek budget, and with the random UTXO reads done during validation, it can get scheduled for seek compaction quickly.

That seek compaction pushes the small file down to L1. Since most UTXOs are already lower down in L4/L5, many reads that consult this file do not find the key there and continue downward. The bloom filter makes those misses cheap, but LevelDB still decrements the file's seek budget. The file then gets scheduled for another seek compaction, and the same pattern pushes it down through L2 and L3.

The expensive part happens around L3/L4. L4 has many ~32 MiB files holding the bulk of the UTXO set. When LevelDB compacts into L3, it may split the output into many smaller L3 files to limit how much L4 "grandparent" data any one output overlaps. Each of these small L3 files then gets its own small seek budget. Because chainstate keys are hash-random, each small L3 file can still have a broad key range, so many random reads consult it and quickly drain its budget. Once seek-compacted into L4, each tiny L3 file can overlap many L4 files, so compacting a few hundred KiB from L3 can require rewriting hundreds of MiB from L4. Repeating that across many small L3 files can rewrite most of the chainstate.

This is a poor fit for chainstate because UTXO keys are hash-random, the DB is large enough to have many levels, writes are relatively small and periodic, and reads are frequent. The result is that read misses trigger compactions much earlier than size pressure would, and those compactions have very high write amplification.

Disabling seek compaction may leave more files in upper levels for longer, so reads could theoretically consult more files. But Bitcoin Core enables bloom filters for all its LevelDB instances, so these misses are usually cheap in-memory filter checks rather than disk reads.

For the other DBs, the risk is much smaller. They also use bloom filters, and most are smaller and less read-heavy. With fewer levels and less random read pressure, disabling seek compaction should have little effect there.

Co-authored-by: l0rinc <[email protected]>

Github-Pull: bitcoin#35313
Rebased-From: 6bfdb6093bba4710d0f8313ed0113967a8b5176f
To match the usage of -latest for the warp runners.

Github-Pull: bitcoin#35408
Rebased-From: 5700a61
@fanquake
fanquake force-pushed the more_30_x_backportss branch from cdd7c79 to f3320b3 Compare June 2, 2026 08:26
@fanquake

fanquake commented Jun 2, 2026

Copy link
Copy Markdown
Member Author

This could still be added even if it's a cherry-pick though right?

Have added.

@marcofleon marcofleon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK f3320b3

Reviewed every commit and compared with the PRs they pulled from. Everything looks good.

@DrahtBot
DrahtBot requested review from andrewtoth and willcl-ark June 2, 2026 12:39
@andrewtoth

Copy link
Copy Markdown
Contributor

ACK f3320b3

@willcl-ark willcl-ark left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK f3320b3

@fanquake
fanquake merged commit 1fb642e into bitcoin:30.x Jun 3, 2026
19 of 20 checks passed
@fanquake
fanquake deleted the more_30_x_backportss branch June 3, 2026 08:51
@fanquake fanquake mentioned this pull request Jun 3, 2026
sedited added a commit that referenced this pull request Jun 23, 2026
d52747d doc: update manual pages for v30.3rc1 (fanquake)
a1406d6 build: bump version to v30.3rc1 (fanquake)
1bdd2b1 doc: update release notes for v30.3rc1 (fanquake)
e7c6d39 fuzz: Remove unused g_setup pointers (MarcoFalke)
b7c7d1e coins: compact chainstate in background (Lőrinc)
992b1dd validation: randomly compact chainstate (Lőrinc)
55ead70 coins: test chainstate flush baseline (Lőrinc)
d09bd0f lint: disable leveldb subtree check (fanquake)

Pull request description:

  Backports:
  * #34918
  * #35465

  Final changes for v`30.3rc1`.

  Backports since `30.2`:
  * #34283
  * #34459
  * #34689
  * #34754
  * #34805
  * #34856
  * #35211
  * #35232

ACKs for top commit:
  sedited:
    ACK d52747d
  marcofleon:
    ACK d52747d

Tree-SHA512: 75fb64f744a0689a9bc4f5a25128bf2aaad7459d7a430f552200b995498428d89de28820f477780f95e7e8485eea9f657ad5fdeae253940df4f29bf51346b4ff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants