-
Notifications
You must be signed in to change notification settings - Fork 1.2k
refactor: delete extra ctors from managers, restore memory-only db for EvoDb and LLMQContext
#6923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
88a2375
301bc70
adb5117
52f7160
5163e85
5dd2e99
556d0b8
a7bec54
5b2e54a
8763104
3c85563
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,24 +75,14 @@ class CoinJoinWalletManager { | |
| using wallet_name_cjman_map = std::map<const std::string, std::unique_ptr<CCoinJoinClientManager>>; | ||
|
|
||
| public: | ||
| CoinJoinWalletManager(ChainstateManager& chainman, CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_metaman, | ||
| const CTxMemPool& mempool, const CMasternodeSync& mn_sync, const llmq::CInstantSendManager& isman, | ||
| const std::unique_ptr<CCoinJoinClientQueueManager>& queueman) : | ||
| m_chainman(chainman), | ||
| m_dmnman(dmnman), | ||
| m_mn_metaman(mn_metaman), | ||
| m_mempool(mempool), | ||
| m_mn_sync(mn_sync), | ||
| m_isman{isman}, | ||
| m_queueman(queueman) | ||
| {} | ||
|
|
||
| ~CoinJoinWalletManager() { | ||
| LOCK(cs_wallet_manager_map); | ||
| for (auto& [wallet_name, cj_man] : m_wallet_manager_map) { | ||
| cj_man.reset(); | ||
| } | ||
| } | ||
| CoinJoinWalletManager() = delete; | ||
| CoinJoinWalletManager(const CoinJoinWalletManager&) = delete; | ||
| CoinJoinWalletManager& operator=(const CoinJoinWalletManager&) = delete; | ||
| explicit CoinJoinWalletManager(ChainstateManager& chainman, CDeterministicMNManager& dmnman, | ||
| CMasternodeMetaMan& mn_metaman, const CTxMemPool& mempool, | ||
| const CMasternodeSync& mn_sync, const llmq::CInstantSendManager& isman, | ||
| const std::unique_ptr<CCoinJoinClientQueueManager>& queueman); | ||
| ~CoinJoinWalletManager(); | ||
|
|
||
| void Add(const std::shared_ptr<wallet::CWallet>& wallet) EXCLUSIVE_LOCKS_REQUIRED(!cs_wallet_manager_map); | ||
| void DoMaintenance(CConnman& connman) EXCLUSIVE_LOCKS_REQUIRED(!cs_wallet_manager_map); | ||
|
|
@@ -235,14 +225,12 @@ class CCoinJoinClientQueueManager : public CCoinJoinBaseManager | |
| mutable Mutex cs_ProcessDSQueue; | ||
|
|
||
| public: | ||
| CCoinJoinClientQueueManager() = delete; | ||
| CCoinJoinClientQueueManager(const CCoinJoinClientQueueManager&) = delete; | ||
| CCoinJoinClientQueueManager& operator=(const CCoinJoinClientQueueManager&) = delete; | ||
| explicit CCoinJoinClientQueueManager(CoinJoinWalletManager& walletman, CDeterministicMNManager& dmnman, | ||
| CMasternodeMetaMan& mn_metaman, const CMasternodeSync& mn_sync) : | ||
| m_walletman(walletman), | ||
| m_dmnman(dmnman), | ||
| m_mn_metaman(mn_metaman), | ||
| m_mn_sync(mn_sync) | ||
| { | ||
| } | ||
| CMasternodeMetaMan& mn_metaman, const CMasternodeSync& mn_sync); | ||
| ~CCoinJoinClientQueueManager(); | ||
|
|
||
| [[nodiscard]] MessageProcessingResult ProcessMessage(NodeId from, CConnman& connman, std::string_view msg_type, | ||
| CDataStream& vRecv) | ||
|
|
@@ -285,21 +273,13 @@ class CCoinJoinClientManager | |
| bool fCreateAutoBackups{true}; // builtin support for automatic backups | ||
|
|
||
| CCoinJoinClientManager() = delete; | ||
| CCoinJoinClientManager(CCoinJoinClientManager const&) = delete; | ||
| CCoinJoinClientManager& operator=(CCoinJoinClientManager const&) = delete; | ||
|
|
||
| CCoinJoinClientManager(const CCoinJoinClientManager&) = delete; | ||
| CCoinJoinClientManager& operator=(const CCoinJoinClientManager&) = delete; | ||
| explicit CCoinJoinClientManager(const std::shared_ptr<wallet::CWallet>& wallet, CDeterministicMNManager& dmnman, | ||
| CMasternodeMetaMan& mn_metaman, const CMasternodeSync& mn_sync, | ||
| const llmq::CInstantSendManager& isman, | ||
| const std::unique_ptr<CCoinJoinClientQueueManager>& queueman) : | ||
| m_wallet(wallet), | ||
| m_dmnman(dmnman), | ||
| m_mn_metaman(mn_metaman), | ||
| m_mn_sync(mn_sync), | ||
| m_isman{isman}, | ||
| m_queueman(queueman) | ||
| { | ||
| } | ||
| const std::unique_ptr<CCoinJoinClientQueueManager>& queueman); | ||
| ~CCoinJoinClientManager(); | ||
|
|
||
|
Comment on lines
275
to
283
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make cached height fields atomic to avoid data races These are updated/read from different threads without a shared lock. Make them std::atomic. - int nCachedLastSuccessBlock{0};
+ std::atomic<int> nCachedLastSuccessBlock{0};
@@
- int nCachedBlockHeight{0};
+ std::atomic<int> nCachedBlockHeight{0};Pair with .cpp changes to use load()/store().
🤖 Prompt for AI Agents |
||
| void ProcessMessage(CNode& peer, CChainState& active_chainstate, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: do you know that you already can't create a copy of CBLSWorker?
All classes that has a non-copyable member are uncoppyable too.
CBLSWorker have 2 of them:
std::mutex sigVerifyMutex;ctpl::thread_pool workerPoolSame applieable for CChainLocksHandler; un-copyable members:
And almost every other class in this PR.
Error message as reference:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am aware but I'd like this the non-copyable property to be inherent to the class definition and not reliant on the state of its members that are subject to change.