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 : #ifndef BITCOIN_LLMQ_OBSERVER_H 6 : #define BITCOIN_LLMQ_OBSERVER_H 7 : 8 : #include <llmq/quorumsman.h> 9 : 10 : #include <validationinterface.h> 11 : 12 : #include <span.h> 13 : 14 : #include <memory> 15 : 16 : class CBlockIndex; 17 : class CDeterministicMNManager; 18 : class CSporkManager; 19 : namespace llmq { 20 : class CDKGDebugManager; 21 : class CDKGSessionManager; 22 : class CQuorum; 23 : class CQuorumSnapshotManager; 24 : } // namespace llmq 25 : namespace util { 26 : struct DbWrapperParams; 27 : } // namespace util 28 : 29 : namespace llmq { 30 : struct ObserverContext final : public QuorumRole, public CValidationInterface { 31 : public: 32 : ObserverContext() = delete; 33 : ObserverContext(const ObserverContext&) = delete; 34 : ObserverContext& operator=(const ObserverContext&) = delete; 35 : ObserverContext(CDeterministicMNManager& dmnman, llmq::CQuorumManager& qman, llmq::CQuorumSnapshotManager& qsnapman, 36 : const ChainstateManager& chainman, const CSporkManager& sporkman, 37 : const util::DbWrapperParams& db_params); 38 : ~ObserverContext(); 39 : 40 : // QuorumRole 41 : // Watch-only nodes are not masternodes 42 0 : bool IsMasternode() const override { return false; } 43 : // We are only initialized if watch-only mode is enabled 44 0 : bool IsWatching() const override { return true; } 45 0 : bool SetQuorumSecretKeyShare(CQuorum& quorum, Span<CBLSSecretKey> skContributions) const override { return false; } 46 : protected: 47 : // CValidationInterface 48 : void InitializeCurrentBlockTip(const CBlockIndex* tip, bool ibd) override; 49 : void UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload) override; 50 : 51 : public: 52 : const std::unique_ptr<llmq::CDKGDebugManager> dkgdbgman; 53 : const std::unique_ptr<llmq::CDKGSessionManager> qdkgsman; 54 : }; 55 : } // namespace llmq 56 : 57 : #endif // BITCOIN_LLMQ_OBSERVER_H