Line data Source code
1 : // Copyright (c) 2014-2015 The Dash developers 2 : // Copyright (c) 2015-2021 The PIVX Core developers 3 : // Distributed under the MIT/X11 software license, see the accompanying 4 : // file COPYING or http://www.opensource.org/licenses/mit-license.php. 5 : 6 : #ifndef PIVX_BUDGET_FINALIZEDBUDGETVOTE_H 7 : #define PIVX_BUDGET_FINALIZEDBUDGETVOTE_H 8 : 9 : #include "messagesigner.h" 10 : #include "primitives/transaction.h" 11 : 12 : #include <univalue.h> 13 : 14 : 15 : // 16 : // CFinalizedBudgetVote - Allow a masternode node to vote and broadcast throughout the network 17 : // 18 : 19 : class CFinalizedBudgetVote : public CSignedMessage 20 : { 21 : private: 22 : bool fValid; //if the vote is currently valid / counted 23 : bool fSynced; //if we've sent this to our peers 24 : CTxIn vin; 25 : uint256 nBudgetHash; 26 : int64_t nTime; 27 : 28 : public: 29 : CFinalizedBudgetVote(); 30 : CFinalizedBudgetVote(const CTxIn& vinIn, const uint256& nBudgetHashIn); 31 : 32 : void Relay() const; 33 : uint256 GetHash() const; 34 : 35 : // override CSignedMessage functions 36 50 : uint256 GetSignatureHash() const override { return GetHash(); } 37 : std::string GetStrMessage() const override; 38 84 : CTxIn GetVin() const { return vin; }; 39 : 40 : UniValue ToJSON() const; 41 : 42 70 : uint256 GetBudgetHash() const { return nBudgetHash; } 43 88 : int64_t GetTime() const { return nTime; } 44 541 : bool IsSynced() const { return fSynced; } 45 15966 : bool IsValid() const { return fValid; } 46 : 47 280 : void SetSynced(bool _fSynced) { fSynced = _fSynced; } 48 3 : void SetTime(const int64_t& _nTime) { nTime = _nTime; } 49 288 : void SetValid(bool _fValid) { fValid = _fValid; } 50 : 51 118 : SERIALIZE_METHODS(CFinalizedBudgetVote, obj) { READWRITE(obj.vin, obj.nBudgetHash, obj.nTime, obj.vchSig, obj.nMessVersion); } 52 : }; 53 : 54 : #endif // PIVX_BUDGET_FINALIZEDBUDGETVOTE_H