6 #ifndef PIVX_BUDGET_BUDGETMANAGER_H
7 #define PIVX_BUDGET_BUDGETMANAGER_H
15 #define ORPHAN_VOTES_CACHE_LIMIT 10000
134 std::vector<CBudgetProposal>
GetBudget();
181 LogPrintf(
"Budget object cleared\n");
192 LOCK(obj.cs_proposals);
193 READWRITE(obj.mapProposals, obj.mapFeeTxToProposal);
197 READWRITE(obj.mapSeenProposalVotes, obj.mapOrphanProposalVotes);
200 LOCK(obj.cs_budgets);
201 READWRITE(obj.mapFinalizedBudgets, obj.mapFeeTxToBudget, obj.mapUnconfirmedFeeTx);
204 LOCK(obj.cs_finalizedvotes);
205 READWRITE(obj.mapSeenFinalizedBudgetVotes, obj.mapOrphanFinalizedBudgetVotes);
int64_t CAmount
Amount in PIV (Can be negative)
CBudgetManager g_budgetman
The block chain is a tree shaped structure starting with the genesis block at the root,...
int GetBestHeight() const
bool AddProposal(CBudgetProposal &budgetProposal)
int GetHighestVoteCount(int chainHeight) const
std::map< uint256, BudVotesAndLastVoteReceivedTime > mapOrphanFinalizedBudgetVotes
std::string strBudgetMode
bool ProcessProposalVote(CBudgetVote &proposal, CNode *pfrom, CValidationState &state)
bool HaveSeenProposalVote(const uint256 &voteHash) const
bool HaveProposal(const uint256 &propHash) const
void SyncSingleItem(CNode *pfrom, const uint256 &nProp)
void SetBudgetProposalsStr(CFinalizedBudget &finalizedBudget) const
void SetSynced(bool synced)
HighestFinBudget GetBudgetWithHighestVoteCount(int chainHeight) const
bool UpdateProposal(const CBudgetVote &vote, CNode *pfrom, std::string &strError)
TrxValidationStatus IsTransactionValid(const CTransaction &txNew, const uint256 &nBlockHash, int nBlockHeight) const
bool GetProposal(const uint256 &nHash, CBudgetProposal &bp) const
RecursiveMutex cs_finalizedvotes
CDataStream GetProposalVoteSerialized(const uint256 &voteHash) const
static CAmount GetTotalBudget(int nHeight)
std::map< uint256, uint256 > mapUnconfirmedFeeTx
std::map< uint256, uint256 > mapFeeTxToBudget
bool HasAnyProposal() const
bool FillBlockPayee(CMutableTransaction &txCoinbase, CMutableTransaction &txCoinstake, const int nHeight, bool fProofOfStake) const
bool GetPayeeAndAmount(int chainHeight, CScript &payeeRet, CAmount &nAmountRet) const
bool AddFinalizedBudget(CFinalizedBudget &finalizedBudget, CNode *pfrom=nullptr)
std::atomic< int > nBestHeight
bool GetFinalizedBudget(const uint256 &nHash, CFinalizedBudget &fb) const
bool ProcessMessage(CNode *pfrom, std::string &strCommand, CDataStream &vRecv, int &banScore)
SERIALIZE_METHODS(CBudgetManager, obj)
bool HaveFinalizedBudget(const uint256 &budgetHash) const
std::pair< std::vector< CBudgetVote >, int64_t > PropVotesAndLastVoteReceivedTime
std::string ToString() const
std::map< uint256, CFinalizedBudget > mapFinalizedBudgets
std::map< uint256, CBudgetVote > mapSeenProposalVotes
CBudgetProposal * FindProposal(const uint256 &nHash)
RecursiveMutex cs_budgets
std::map< uint256, CBudgetProposal > mapProposals
int ProcessProposal(CBudgetProposal &proposal)
std::vector< CBudgetProposal > GetBudget()
const CBudgetProposal * FindProposalByName(const std::string &strProposalName) const
bool ProcessFinalizedBudgetVote(CFinalizedBudgetVote &vote, CNode *pfrom, CValidationState &state)
RecursiveMutex cs_proposals
CDataStream GetProposalSerialized(const uint256 &propHash) const
uint256 SubmitFinalBudget()
std::map< uint256, PropVotesAndLastVoteReceivedTime > mapOrphanProposalVotes
CDataStream GetFinalizedBudgetSerialized(const uint256 &budgetHash) const
std::map< uint256, uint256 > mapFeeTxToProposal
void VoteOnFinalizedBudgets()
std::string GetRequiredPaymentsString(int nBlockHeight)
std::vector< CBudgetProposal * > GetAllProposalsOrdered()
bool GetExpectedPayeeAmount(int chainHeight, CAmount &nAmountRet) const
CDataStream GetFinalizedBudgetVoteSerialized(const uint256 &voteHash) const
CFinalizedBudget * FindFinalizedBudget(const uint256 &nHash)
std::vector< CFinalizedBudget * > GetFinalizedBudgets()
void RemoveByFeeTxId(const uint256 &feeTxId)
void RemoveStaleVotesOnFinalBudget(CFinalizedBudget *fbud)
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override
Notifies listeners when the block chain tip advances.
void SetBestHeight(int height)
bool HaveSeenFinalizedBudgetVote(const uint256 &voteHash) const
int ProcessFinalizedBudget(CFinalizedBudget &finalbudget, CNode *pfrom)
int ProcessBudgetVoteSync(const uint256 &nProp, CNode *pfrom)
int ProcessMessageInner(CNode *pfrom, std::string &strCommand, CDataStream &vRecv)
Process the message and returns the ban score (0 if no banning is needed)
void Sync(CNode *node, bool fPartial)
void AddSeenFinalizedBudgetVote(const CFinalizedBudgetVote &vote)
std::pair< std::vector< CFinalizedBudgetVote >, int64_t > BudVotesAndLastVoteReceivedTime
bool IsBudgetPaymentBlock(int nBlockHeight) const
std::string GetFinalizedBudgetStatus(const uint256 &nHash) const
std::map< uint256, CFinalizedBudgetVote > mapSeenFinalizedBudgetVotes
void ForceAddFinalizedBudget(const uint256 &nHash, const uint256 &feeTxId, const CFinalizedBudget &finalizedBudget)
void AddSeenProposalVote(const CBudgetVote &vote)
bool AddAndRelayProposalVote(const CBudgetVote &vote, std::string &strError)
bool UpdateFinalizedBudget(const CFinalizedBudgetVote &vote, CNode *pfrom, std::string &strError)
void RemoveStaleVotesOnProposal(CBudgetProposal *prop)
Information about a peer.
Serialized script, used inside transaction inputs and outputs.
The basic transaction that is broadcasted on the network and contained in blocks.
Implement this to subscribe to events generated in validation.
Capture information about block/transaction validation.
const CFinalizedBudget * m_budget_fin
A mutable version of CTransaction.
#define WITH_LOCK(cs, code)
Run code while locking a mutex.