PIVX Core  5.6.99
P2P Digital Currency
finalizedbudgetvote.cpp
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 
7 
8 #include "net.h"
9 
12  fValid(true),
13  fSynced(false),
14  vin(),
15  nBudgetHash(),
16  nTime(0)
17 { }
18 
19 CFinalizedBudgetVote::CFinalizedBudgetVote(const CTxIn& vinIn, const uint256& nBudgetHashIn) :
21  fValid(true),
22  fSynced(false),
23  vin(vinIn),
24  nBudgetHash(nBudgetHashIn)
25 {
27 }
28 
30 {
32  g_connman->RelayInv(inv);
33 }
34 
36 {
37  CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
38  ss << vin;
39  ss << nBudgetHash;
40  ss << nTime;
41  return ss.GetHash();
42 }
43 
45 {
47  bObj.pushKV("nHash", GetHash().ToString());
48  bObj.pushKV("nTime", (int64_t) nTime);
49  bObj.pushKV("fValid", fValid);
50  return bObj;
51 }
52 
54 {
55  return strprintf("%s %s %d", vin.prevout.ToStringShort(), nBudgetHash.ToString(), nTime);
56 }
true
Definition: bls_dkg.cpp:153
false
Definition: bls_dkg.cpp:151
std::string ToStringShort() const
Definition: transaction.cpp:13
std::string GetStrMessage() const override
A writer stream (for serialization) that computes a 256-bit hash.
Definition: hash.h:216
uint256 GetHash()
Definition: hash.h:236
inv message data
Definition: protocol.h:466
Base Class for all signed messages on the network.
Definition: messagesigner.h:63
An input of a transaction.
Definition: transaction.h:94
COutPoint prevout
Definition: transaction.h:96
@ VOBJ
Definition: univalue.h:21
bool pushKV(const std::string &key, const UniValue &val)
Definition: univalue.cpp:133
std::string ToString() const
Definition: uint256.cpp:65
256-bit opaque blob.
Definition: uint256.h:138
std::unique_ptr< CConnman > g_connman
Definition: init.cpp:90
@ MSG_BUDGET_FINALIZED_VOTE
Definition: protocol.h:449
@ SER_GETHASH
Definition: serialize.h:176
int64_t GetAdjustedTime()
Definition: timedata.cpp:36
#define strprintf
Definition: tinyformat.h:1056