6 #ifndef PIVX_MASTERNODE_H
7 #define PIVX_MASTERNODE_H
20 static const unsigned int MNPING_DEPTH = 12;
61 bool CheckAndUpdate(
int& nDos,
bool fRequireAvailable =
true,
bool fCheckSigTimeOnly =
false);
150 READWRITE(obj.vin, obj.addr, obj.pubKeyCollateralAddress);
151 READWRITE(obj.pubKeyMasternode, obj.vchSig, obj.sigTime, obj.protocolVersion);
152 READWRITE(obj.lastPing, obj.nScanningErrorCount, obj.nLastScanningErrorBlockHeight);
154 if (obj.protocolVersion == MIN_BIP155_PROTOCOL_VERSION) {
155 bool dummyIsBIP155Addr =
false;
160 template <
typename Stream>
217 return strprintf(
"INVALID_%d", activeState);
274 static bool Create(
const std::string& strService,
const std::string& strKey,
const std::string& strTxHash,
const std::string& strOutputIndex, std::string& strErrorRet,
CMasternodeBroadcast& mnbRet,
bool fOffline,
int chainHeight);
An encapsulated private key.
static bool CheckDefaultPort(CService service, std::string &strErrorRet, const std::string &strContext)
static bool Create(const CTxIn &vin, const CService &service, const CKey &keyCollateralAddressNew, const CPubKey &pubKeyCollateralAddressNew, const CKey &keyMasternodeNew, const CPubKey &pubKeyMasternodeNew, std::string &strErrorRet, CMasternodeBroadcast &mnbRet)
Create Masternode broadcast, needs to be relayed manually after that.
bool CheckAndUpdate(int &nDoS)
SERIALIZE_METHODS(CMasternodeBroadcast, obj)
bool CheckSignature() const
bool Sign(const CKey &key, const CPubKey &pubKey)
uint256 GetSignatureHash() const override
int nLastScanningErrorBlockHeight
arith_uint256 CalculateScore(const uint256 &hash) const
bool IsAvailableState() const
bool IsPreEnabled() const
void SetLastPing(const CMasternodePing &_lastPing)
CMasternode(deserialize_type, Stream &s)
CMasternode & operator=(const CMasternode &other)
bool IsBroadcastedWithin(int seconds)
std::string Status() const
CPubKey GetPubKey() const
std::string GetStrMessage() const override
bool UpdateFromNewBroadcast(CMasternodeBroadcast &mnb)
bool IsValidNetAddr() const
bool IsPingedWithin(int seconds, int64_t now=-1) const
CMasternode::state GetActiveState() const
SERIALIZE_METHODS(CMasternode, obj)
friend bool operator!=(const CMasternode &a, const CMasternode &b)
const CTxIn GetVin() const
friend bool operator==(const CMasternode &a, const CMasternode &b)
CScript GetPayeeScript() const
CPubKey pubKeyCollateralAddress
CMasternodePing & operator=(const CMasternodePing &other)=default
bool CheckAndUpdate(int &nDos, bool fRequireAvailable=true, bool fCheckSigTimeOnly=false)
uint256 GetSignatureHash() const override
SERIALIZE_METHODS(CMasternodePing, obj)
friend bool operator==(const CMasternodePing &a, const CMasternodePing &b)
friend bool operator!=(const CMasternodePing &a, const CMasternodePing &b)
std::string GetStrMessage() const override
const CTxIn GetVin() const
An encapsulated public key.
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
Serialized script, used inside transaction inputs and outputs.
A combination of a network address (CNetAddr) and a (TCP) port.
Base Class for all signed messages on the network.
std::vector< unsigned char > vchSig
An input of a transaction.
256-bit unsigned big integer.
std::shared_ptr< const CDeterministicMN > CDeterministicMNCPtr
int MasternodeMinPingSeconds()
int MasternodeBroadcastSeconds()
int MasternodeExpirationSeconds()
int MasternodeRemovalSeconds()
std::shared_ptr< CMasternode > MasternodeRef
std::shared_ptr< const CDeterministicMN > CDeterministicMNCPtr
int MasternodePingSeconds()
MasternodeRef MakeMasternodeRefForDMN(const CDeterministicMNCPtr &dmn)
void Unserialize(Stream &s, char &a)
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a PIVX scriptPubKey for the given CTxDestination.
Dummy data type to identify deserializing constructors.
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
int64_t GetAdjustedTime()