mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
2b61dd8673
## Issue being fixed or feature implemented Build on linux with clang produce a lot of warnings. Some of them are fixed in this PR. ## What was done? Fixed several types of warnings: - order of member initialization in constructors - mixing signed/unsigned wariables - moved static functions from header to cpp file - other fixes ## How Has This Been Tested? Set up clang build on Linux + run build + unit/functional tests. ## Breaking Changes Should not be breaking changes ## Checklist: - [x] I have performed a self-review of my own code - [x] I have assigned this pull request to a milestone
70 lines
1.9 KiB
C++
70 lines
1.9 KiB
C++
// Copyright (c) 2014-2022 The Dash Core developers
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_MASTERNODE_NODE_H
|
|
#define BITCOIN_MASTERNODE_NODE_H
|
|
|
|
#include <netaddress.h>
|
|
#include <primitives/transaction.h>
|
|
#include <validationinterface.h>
|
|
|
|
class CBLSPublicKey;
|
|
class CBLSSecretKey;
|
|
|
|
struct CActiveMasternodeInfo;
|
|
class CActiveMasternodeManager;
|
|
|
|
extern CActiveMasternodeInfo activeMasternodeInfo;
|
|
extern CCriticalSection activeMasternodeInfoCs;
|
|
extern std::unique_ptr<CActiveMasternodeManager> activeMasternodeManager;
|
|
|
|
struct CActiveMasternodeInfo {
|
|
// Keys for the active Masternode
|
|
std::unique_ptr<CBLSPublicKey> blsPubKeyOperator;
|
|
std::unique_ptr<CBLSSecretKey> blsKeyOperator;
|
|
|
|
// Initialized while registering Masternode
|
|
uint256 proTxHash;
|
|
COutPoint outpoint;
|
|
CService service;
|
|
};
|
|
|
|
|
|
class CActiveMasternodeManager final : public CValidationInterface
|
|
{
|
|
public:
|
|
enum masternode_state_t {
|
|
MASTERNODE_WAITING_FOR_PROTX,
|
|
MASTERNODE_POSE_BANNED,
|
|
MASTERNODE_REMOVED,
|
|
MASTERNODE_OPERATOR_KEY_CHANGED,
|
|
MASTERNODE_PROTX_IP_CHANGED,
|
|
MASTERNODE_READY,
|
|
MASTERNODE_ERROR,
|
|
};
|
|
|
|
private:
|
|
masternode_state_t state{MASTERNODE_WAITING_FOR_PROTX};
|
|
std::string strError;
|
|
CConnman& connman;
|
|
|
|
public:
|
|
explicit CActiveMasternodeManager(CConnman& _connman) : connman(_connman) {};
|
|
~CActiveMasternodeManager() = default;
|
|
|
|
void UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload) override;
|
|
|
|
void Init(const CBlockIndex* pindex);
|
|
|
|
std::string GetStateString() const;
|
|
std::string GetStatus() const;
|
|
|
|
static bool IsValidNetAddr(CService addrIn);
|
|
|
|
private:
|
|
bool GetLocalAddress(CService& addrRet);
|
|
};
|
|
|
|
#endif // BITCOIN_MASTERNODE_NODE_H
|