6 #ifndef PIVX_MASTERNODE_PAYMENTS_H
7 #define PIVX_MASTERNODE_PAYMENTS_H
25 #define MNPAYMENTS_SIGNATURES_REQUIRED 6
26 #define MNPAYMENTS_SIGNATURES_TOTAL 10
109 if (payee.scriptPubKey == payeeIn) {
110 payee.nVotes += nIncrement;
125 if (p.nVotes > nVotes) {
126 payee = p.scriptPubKey;
131 return (nVotes > -1);
139 if (p.nVotes >= nVotesReq && p.scriptPubKey == payee)
return true;
192 std::string ret =
"";
196 ret +=
", " + std::to_string((
int)
vchSig.size());
232 void Sync(
CNode* node,
int nCountNeeded);
int64_t CAmount
Amount in PIV (Can be negative)
The block chain is a tree shaped structure starting with the genesis block at the root,...
CMasternodeBlockPayees(int nBlockHeightIn)
std::string GetRequiredPaymentsString()
bool HasPayeeWithVotes(const CScript &payee, int nVotesReq)
SERIALIZE_METHODS(CMasternodeBlockPayees, obj)
void AddPayee(const CScript &payeeIn, int nIncrement)
std::vector< CMasternodePayee > vecPayments
bool GetPayee(CScript &payee) const
bool IsTransactionValid(const CTransaction &txNew, int nBlockHeight)
CMasternodePayee(CScript payee, int nVotesIn)
SERIALIZE_METHODS(CMasternodePayee, obj)
Save Masternode Payment Data (mnpayments.dat)
bool Write(const CMasternodePayments &objToSave)
ReadResult Read(CMasternodePayments &objToLoad)
std::string strMagicMessage
CMasternodePaymentWinner()
void AddPayee(const CScript &payeeIn)
bool IsValid(CNode *pnode, CValidationState &state, int chainHeight)
std::string GetStrMessage() const override
uint256 GetSignatureHash() const override
CMasternodePaymentWinner(const CTxIn &vinIn, int nHeight)
SERIALIZE_METHODS(CMasternodePaymentWinner, obj)
SERIALIZE_METHODS(CMasternodePayments, obj)
bool CanVote(const COutPoint &outMasternode, int nBlockHeight) const
void ProcessBlock(int nBlockHeight)
void AddWinningMasternode(CMasternodePaymentWinner &winner)
void CleanPaymentList(int mnCount, int nHeight)
bool GetMasternodeTxOuts(const CBlockIndex *pindexPrev, std::vector< CTxOut > &voutMasternodePaymentsRet) const
bool IsTransactionValid(const CTransaction &txNew, const CBlockIndex *pindexPrev)
std::string GetRequiredPaymentsString(int nBlockHeight)
void RecordWinnerVote(const COutPoint &outMasternode, int nBlockHeight)
std::map< int, CMasternodeBlockPayees > mapMasternodeBlocks
void Sync(CNode *node, int nCountNeeded)
bool IsScheduled(const CMasternode &mn, int nNotBlockHeight)
std::map< COutPoint, int > mapMasternodesLastVote
bool GetBlockPayee(int nBlockHeight, CScript &payee) const
void FillBlockPayee(CMutableTransaction &txCoinbase, CMutableTransaction &txCoinstake, const CBlockIndex *pindexPrev, bool fProofOfStake) const
std::map< uint256, CMasternodePaymentWinner > mapMasternodePayeeVotes
std::string ToString() const
bool ProcessMNWinner(CMasternodePaymentWinner &winner, CNode *pfrom, CValidationState &state)
bool ProcessMessageMasternodePayments(CNode *pfrom, std::string &strCommand, CDataStream &vRecv, CValidationState &state)
bool GetLegacyMasternodeTxOut(int nHeight, std::vector< CTxOut > &voutMasternodePaymentsRet) const
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override
Notifies listeners when the block chain tip advances.
Information about a peer.
An outpoint - a combination of a transaction hash and an index n into its vout.
Serialized script, used inside transaction inputs and outputs.
Base Class for all signed messages on the network.
std::vector< unsigned char > vchSig
The basic transaction that is broadcasted on the network and contained in blocks.
An input of a transaction.
std::string ToString() const
Implement this to subscribe to events generated in validation.
Capture information about block/transaction validation.
RecursiveMutex cs_mapMasternodePayeeVotes
bool IsBlockValueValid(int nHeight, CAmount &nExpectedValue, CAmount nMinted, CAmount &nBudgetAmt)
std::string GetRequiredPaymentsString(int nBlockHeight)
RecursiveMutex cs_mapMasternodeBlocks
CMasternodePayments masternodePayments
Object for who's going to get paid on which blocks.
void DumpMasternodePayments()
bool IsCoinbaseValueValid(const CTransactionRef &tx, CAmount nBudgetAmt, CValidationState &_state)
Check coinbase output value for blocks after v6.0 enforcement.
bool IsBlockPayeeValid(const CBlock &block, const CBlockIndex *pindexPrev)
RecursiveMutex cs_vecPayments
void FillBlockPayee(CMutableTransaction &txCoinbase, CMutableTransaction &txCoinstake, const CBlockIndex *pindexPrev, bool fProofOfStake)
A mutable version of CTransaction.
std::shared_ptr< const CTransaction > CTransactionRef
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.