Line data Source code
1 : // Copyright (c) 2025-2026 The Dash Core developers 2 : // Distributed under the MIT software license, see the accompanying 3 : // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 : 5 : #include <llmq/observer.h> 6 : 7 : #include <llmq/debug.h> 8 : #include <llmq/dkgsessionmgr.h> 9 : 10 : namespace llmq { 11 0 : ObserverContext::ObserverContext(CDeterministicMNManager& dmnman, llmq::CQuorumManager& qman, 12 : llmq::CQuorumSnapshotManager& qsnapman, const ChainstateManager& chainman, 13 : const CSporkManager& sporkman, const util::DbWrapperParams& db_params) : 14 0 : QuorumRole{qman}, 15 0 : dkgdbgman{std::make_unique<llmq::CDKGDebugManager>(dmnman, qsnapman, chainman)}, 16 0 : qdkgsman{std::make_unique<llmq::CDKGSessionManager>(dmnman, qsnapman, chainman, sporkman, db_params)} 17 0 : { 18 0 : } 19 : 20 0 : ObserverContext::~ObserverContext() = default; 21 : 22 0 : void ObserverContext::InitializeCurrentBlockTip(const CBlockIndex* tip, bool ibd) 23 : { 24 0 : UpdatedBlockTip(tip, nullptr, ibd); 25 0 : } 26 : 27 0 : void ObserverContext::UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload) 28 : { 29 0 : if (fInitialDownload || pindexNew == pindexFork) // In IBD or blocks were disconnected without any new ones 30 0 : return; 31 : 32 0 : qdkgsman->UpdatedBlockTip(pindexNew, fInitialDownload); 33 0 : } 34 : } // namespace llmq