refactor: move CConnman and PeerManager out of CDeterministicMNManager, LLMQContext member ctors, reduce use in CJContext#6443
Merged
PastaPastaPasta merged 11 commits intodashpay:developfrom Dec 9, 2024
Conversation
|
This pull request has conflicts, please rebase. |
Collaborator
Author
|
Latest changes are whitespace only (applying |
knst
previously approved these changes
Dec 5, 2024
src/llmq/dkgsessionhandler.h
Outdated
| void ProcessMessage(const CNode& pfrom, PeerManager& peerman, const std::string& msg_type, CDataStream& vRecv); | ||
|
|
||
| void StartThread(); | ||
| void StartThread(PeerManager& peerman); |
Collaborator
There was a problem hiding this comment.
that's a good solution to pass PeerManager when thread start. Wow!
Alternate fix as proposed in dash#5752, needed because dependencies for threaded logic will be pulled out of ctor in upcoming commits and that needs `Start` to be pushed downwards so we can avoid having to pass `unique_ptr` references.
Co-authored-by: Konstantin Akimov <knstqq@gmail.com>
Collaborator
Author
UdjinM6
approved these changes
Dec 7, 2024
5 tasks
PastaPastaPasta
added a commit
that referenced
this pull request
Dec 17, 2024
…ng sequence between {,non-}unittest codepaths)
1974651 refactor: move remaining `LogPrintf` usage outside (Kittywhiskers Van Gogh)
04dbaa8 style-only: Remove redundant scope in *Chainstate (Kittywhiskers Van Gogh)
872158d Remove all #include // for * comments (Kittywhiskers Van Gogh)
09ab629 test/setup: Use LoadChainstate (Kittywhiskers Van Gogh)
459f339 node/chainstate: extract Dash post-`InitializeChainstate` logic (Kittywhiskers Van Gogh)
c06e074 node/chainstate: Add options for in-memory DBs (Kittywhiskers Van Gogh)
52bb35d node/caches: Remove intermediate variables (Kittywhiskers Van Gogh)
4ab1827 node/caches: Extract cache calculation logic (Kittywhiskers Van Gogh)
d7f1e23 validation: VerifyDB only needs Consensus::Params (Kittywhiskers Van Gogh)
c405492 node/chainstate: Decouple from ShutdownRequested (Kittywhiskers Van Gogh)
fdf803d node/chainstate: Decouple from GetTime (Kittywhiskers Van Gogh)
f7aef8d init: Delay RPC block notif until warmup finished (Kittywhiskers Van Gogh)
94c0ceb Move -checkblocks LogPrintf to AppInitMain (Kittywhiskers Van Gogh)
d3345ee node/chainstate: Reduce coupling of LogPrintf (Kittywhiskers Van Gogh)
a141f5d node/chainstate: Decouple from concept of uiInterface (Kittywhiskers Van Gogh)
913411e Split off VerifyLoadedChainstate (Kittywhiskers Van Gogh)
53231ca node/chainstate: Remove do/while loop (Kittywhiskers Van Gogh)
2ea1bbc Move init logistics message for BAD_GENESIS_BLOCK to init.cpp (Kittywhiskers Van Gogh)
29c7362 Move mempool nullptr Assert out of LoadChainstate (Kittywhiskers Van Gogh)
7071282 node/chainstate: Decouple from concept of NodeContext (Kittywhiskers Van Gogh)
ee9d3dd node/chainstate: Decouple from ArgsManager (Kittywhiskers Van Gogh)
d7419e4 node/chainstate: Decouple from stringy errors (Kittywhiskers Van Gogh)
9ab08c4 node/chainstate: Decouple from GetTimeMillis (Kittywhiskers Van Gogh)
2455c06 node: Extract chainstate loading sequence (Kittywhiskers Van Gogh)
620146b chore: sync chainstate loading logic with upstream (Kittywhiskers Van Gogh)
Pull request description:
## Additional Information
* Dependent on #6296
* Dependent on #6443
* As one of the backport's intentions were to unify code between `init.cpp` and `setup_common.cpp`, Dash-specific initialization code (to the extent that it can be moved out non-disruptively) has been spun out into `DashChainstateSetup{,Close}()` so it can also be used in `setup_common.cpp` and `validation_chainstatemanager_tests.cpp`.
This is also why `DashTestSetup{,Close}()` (now `DashPostChainstateSetup{,Close}()`) was introduced in [dash#5531](#5531).
* `DashChainstateSetup{,Close}()` (as defined in `node/chainstate.cpp`) cannot take `NodeContext` in because `node/chainstate.cpp` is used in `bitcoin-chainstate`, which doesn't include `NodeContext` ([source](https://github.com/bitcoin/bitcoin/pull/24304/files#diff-4cb884d03ebb901069e4ee5de5d02538c40dd9b39919c615d8eaa9d364bbbd77R795-R798)), this is reflected by neither `LoadChainstate` nor `VerifyLoadedChainstate` taking in `NodeContext`.
* To make it less onerous to use in unit tests, `DashChainstateSetup{,Close}()` has been overloaded with a variant that accepts `NodeContext`.
* To remove `LogPrintf` usage in `node/chainstate.cpp`, index enablement reporting has been pulled out of chainstate loading and BLS scheme reporting has been abstracted out using `notify_bls_state`.
## Breaking Changes
None expected.
## Checklist
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)**
- [x] I have added or updated relevant unit/integration/functional/e2e tests
- [x] I have made corresponding changes to the documentation **(note: N/A)**
- [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_
ACKs for top commit:
UdjinM6:
utACK 1974651
PastaPastaPasta:
utACK 1974651
Tree-SHA512: 8ebfce48dccc6a867339aff9374a4cb8dc7b02b0c17432db2b97c982523d0d9589a87e6527a103f314bf32be176486311ef6dcde1c4d5cdccc1eeb1f80bbb040
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.
Additional Information
init.cppin bitcoin#23280), the spinning up of threads (as done inLLMQContext::Start()) needs to be moved down.CBLSWorkeris a part ofLLMQContextandCBLSWorkeris needed during chainstate verification. As suggested in dash#5752, an alternate fix to the one already merged in was to moveCBLSWorkerStart()/Stop()to the constructor, which is done here.LLMQContextentirely and let it remain inNodeContextthough this approach has not been taken.bitcoin-chainstate(the binary introduced in bitcoin#24304 that's built on the code split off in bitcoin#23280) aims to be devoid of P2P logic and this is reflected in the source files used to build it (source). (Also, there's noNodeContext, source)CConnmanandPeerManager) out of constructors.LLMQContext::Start()orPeerManagerImpl::ProcessMessage()).Breaking Changes
None expected. While changes are present in initialization order, consensus behaviour should remain unchanged.
Checklist: