Repository navigation
Conversation
ChainMan declares m_context last, which destroys it before the ChainstateManager that refers into it. Reset the chainstate manager explicitly, making the order independent of member declaration order.
Create the BlockManager first and pass it in by reference. NodeContext and the kernel own both and destroy ChainstateManager first. The block tree database opens before the script verification threads start, which swaps their startup log lines.
The flag duplicated the BlockManager's prune mode. Init and the test setup copied it, and the kernel left it false. Check the BlockManager directly, keeping one source of truth before the kernel can enable pruning.
Block storage was configured and read through the chainstate manager. Add btck_BlockManagerOptions and btck_BlockManager, and pass the block manager to btck_chainstate_manager_create, which keeps a shared reference, so either can be destroyed first. A block manager serves one chainstate manager. btck_block_read and btck_block_spent_outputs_read take the block manager. Each options object takes the total database cache and uses its part. Wiping the block tree db also wipes the chainstate db.
Contributor
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. LLM Linter (✨ experimental)Possible places where comparison-specific test macros should replace generic comparisons:
2026-11-13 15:09:15 |
This was referenced Nov 13, 2026
This was referenced Nov 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The kernel creates its block storage inside
btck_chainstate_manager_create, configures it through the chainstate manager's options and reads blocks through the chainstate manager. Pruning (#35627) needs block storage that the caller can configure, keep and prune directly.This adds
btck_BlockManagerOptionsandbtck_BlockManager.btck_chainstate_manager_createtakes a block manager and keeps a shared reference to it, so either handle can be destroyed first. A block manager can be passed to only one chainstate manager, and a failed creation still uses it up unless the contexts differ.btck_block_readandbtck_block_spent_outputs_readtake the block manager, and block tree entries are valid for its lifetime, which can be longer than the chainstate manager's.Changes for callers:
btck_chainstate_manager_options_createno longer takes a blocks directory.btck_chainstate_manager_options_set_wipe_dbsis replaced bybtck_block_manager_options_update_wipe_block_tree_dbandbtck_chainstate_manager_options_update_wipe_chainstate_db. The block tree db is wiped when the block manager is created, and wiping it also wipes the chainstate db, which the old function required anyway.btck_chainstate_manager_options_update_block_tree_db_in_memorymoves to the block manager options.Based on #36739. Draft until it is merged. Feedback on the API is welcome in the meantime.