Repository navigation
refactor: Remove need to pass chainparams to BlockManager methods - #27570
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. 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. |
dergoegge
left a comment
There was a problem hiding this comment.
Concept ACK
Should we do the same for Consensus::Params?
Yes, this is what this pull is doing. |
dergoegge
left a comment
There was a problem hiding this comment.
Yes, this is what this pull is doing.
Sorry, I was confused because Consensus::Params are stil being passed to ReadBlockFromDisk.
and use it in blockstorage.cpp
pindex can not be nullptr, so document that, and clear it up in the next commit.
Also, replace pointer with reference while touching the signature.
fa1e7fb to
fa5d7c3
Compare
|
What about these three: bitcoin/src/node/blockstorage.h Lines 237 to 239 in fa5d7c3 |
|
They are not members of the |
Ugh for some reason I thought #27125 was already merged🤦 |
| { | ||
| const auto params {CreateChainParams(ArgsManager{}, CBaseChainParams::MAIN)}; | ||
| BlockManager blockman{{}}; | ||
| node::BlockManager::Options blockman_opts{ |
There was a problem hiding this comment.
Nit: Can be const (here and elsewhere) and skip the node:: namespacing, since it is imported above. If this is merged before #27125 I will follow-up there.
There was a problem hiding this comment.
I left it mutable to make it less code-churn to run ApplyArgsManOptions in the future, which you called in 27125 at some point, but no longer in the current state.
I'll remove node:: in the next push or maybe a follow-up.
|
Is this some kind of dependency for libbitcoinkernel or for something other than general tidy-up impulses? If so, feel free to merge - assumeutxo is fresh in my brain and handling the rebase won't be so painful as a result. Otherwise, wouldn't mind this getting shelved for later. But really no big deal either way. I'd say if you're going to merge do it soon so that I can manage the rebase with fresh context. |
It spawned out of here: #27125 (comment). If you're happy to rebase over then I'm just going to go-ahead and merge this now. @TheCharlatan can then address any of his own comments as part of #27125 (which is also going to conflict with 15606, so probably worth having a look there as well.) |
Summary: and use it in blockstorage.cpp PR rationale: > Seems confusing to pass chainparams to each method individually, when the params can't change anyway for the whole lifetime of the block manager, and also must be equal to the ones used by the chainstate manager. > > Fix this issue by removing them from the methods and instead storing a reference once in a member field. This is a partial backport of [[bitcoin/bitcoin#27570 | core#27570]] bitcoin/bitcoin@facdb8b (partial) bitcoin/bitcoin@fa5d7c3 Depends on D16010 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D16015
Summary: pindex can not be nullptr, so document that. This concludes backport of [[bitcoin/bitcoin#27570 | core#27570]] bitcoin/bitcoin@fa3f74a (partial) bitcoin/bitcoin@fa5d7c3 Depends on D16015 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D16016
Seems confusing to pass chainparams to each method individually, when the params can't change anyway for the whole lifetime of the block manager, and also must be equal to the ones used by the chainstate manager.
Fix this issue by removing them from the methods and instead storing a reference once in a member field.