PIVX Core  5.6.99
P2P Digital Currency
finalizedbudgetvote.h
Go to the documentation of this file.
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 
20 {
21 private:
22  bool fValid; //if the vote is currently valid / counted
23  bool fSynced; //if we've sent this to our peers
26  int64_t nTime;
27 
28 public:
30  CFinalizedBudgetVote(const CTxIn& vinIn, const uint256& nBudgetHashIn);
31 
32  void Relay() const;
33  uint256 GetHash() const;
34 
35  // override CSignedMessage functions
36  uint256 GetSignatureHash() const override { return GetHash(); }
37  std::string GetStrMessage() const override;
38  CTxIn GetVin() const { return vin; };
39 
40  UniValue ToJSON() const;
41 
42  uint256 GetBudgetHash() const { return nBudgetHash; }
43  int64_t GetTime() const { return nTime; }
44  bool IsSynced() const { return fSynced; }
45  bool IsValid() const { return fValid; }
46 
47  void SetSynced(bool _fSynced) { fSynced = _fSynced; }
48  void SetTime(const int64_t& _nTime) { nTime = _nTime; }
49  void SetValid(bool _fValid) { fValid = _fValid; }
50 
51  SERIALIZE_METHODS(CFinalizedBudgetVote, obj) { READWRITE(obj.vin, obj.nBudgetHash, obj.nTime, obj.vchSig, obj.nMessVersion); }
52 };
53 
54 #endif // PIVX_BUDGET_FINALIZEDBUDGETVOTE_H
void SetSynced(bool _fSynced)
std::string GetStrMessage() const override
SERIALIZE_METHODS(CFinalizedBudgetVote, obj)
uint256 GetBudgetHash() const
void SetTime(const int64_t &_nTime)
uint256 GetSignatureHash() const override
void SetValid(bool _fValid)
Base Class for all signed messages on the network.
Definition: messagesigner.h:63
An input of a transaction.
Definition: transaction.h:94
256-bit opaque blob.
Definition: uint256.h:138
#define READWRITE(...)
Definition: serialize.h:183