AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 22 Bitcoin

validation: randomly compact chainstate

Public commit record

What the developer wrote

Authored by Lőrinc

70/100 · Adequate
validation: randomly compact chainstate

Full chainstate flushes are convenient maintenance points for long-term LevelDB cleanup because the chainstate was just written.
Randomize the trigger so nodes that flush near the same height do not compact together.

Add blocking chainstate compaction through `CCoinsViewDB::CompactFull()` and give each post-IBD full flush on the normal chainstate a 1/320 chance to start compaction.
With hourly flushes this averages roughly every two weeks and makes a six-month miss about one in a million.
This keeps the schedule stateless and leaves last-compaction height or timestamp bookkeeping out of chainstate metadata.

Co-authored-by: Andrew Toth <andrewstoth@gmail.com>
✓ Descriptive subject✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This change makes Bitcoin Core occasionally clean up its chainstate database after a normal full flush, and randomizes when that cleanup happens so different nodes don't all do it at the same time. It is a maintenance/performance improvement, not a security fix, and does not introduce a known vulnerability.

Recommended action

No security action required. Treat as routine maintenance/performance improvement. Reviewers may want to confirm the 1/320 probability and blocking behavior are acceptable for node operational stability.

Security signals we found

01

No security-relevant signals in commit message or diff

02

Change is operational/performance: randomized database compaction scheduling

03

Compaction is blocking and holds cs_main; potential transient availability impact, not a security flaw

04

No input validation, cryptography, consensus, or permission changes

Risk score

Why this scored 22/100

Our methodology →
Potential impact 2/30
Exploitability 0/25
Stealth signal 1/15
Affected reach 5/15
Confidence 9/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.