added dynamic registers

This commit is contained in:
Evan Duffield 2016-04-16 10:19:17 -07:00
parent 31d8a4d16f
commit 59ddc0d71e
5 changed files with 126 additions and 106 deletions

View File

@ -8,7 +8,7 @@
has:
vector<CNetworkVariable> vecNetworkVariables;
vector<CDashProject> vecProjects;
vector<CBudgetProposal> vecProposals;
vector<CGovernanceObject> vecProposals;
vector<CBudgetContract> vecContracts;
vector<CBudgetUsers> vecUsers;

View File

@ -24,7 +24,7 @@ CGovernanceManager governance;
CCriticalSection cs_budget;
std::map<uint256, int64_t> askedForSourceProposalOrBudget;
std::vector<CBudgetProposal> vecImmatureBudgetProposals;
std::vector<CGovernanceObject> vecImmatureBudgetProposals;
int nSubmittedFinalBudget;
@ -34,7 +34,7 @@ bool IsCollateralValid(uint256 nTxCollateralHash, uint256 nExpectedHash, std::st
uint256 nBlockHash;
if(!GetTransaction(nTxCollateralHash, txCollateral, Params().GetConsensus(), nBlockHash, true)){
strError = strprintf("Can't find collateral tx %s", txCollateral.ToString());
LogPrintf ("CBudgetProposal::IsCollateralValid - %s\n", strError);
LogPrintf ("CGovernanceObject::IsCollateralValid - %s\n", strError);
return false;
}
@ -48,7 +48,7 @@ bool IsCollateralValid(uint256 nTxCollateralHash, uint256 nExpectedHash, std::st
BOOST_FOREACH(const CTxOut o, txCollateral.vout){
if(!o.scriptPubKey.IsNormalPaymentScript() && !o.scriptPubKey.IsUnspendable()){
strError = strprintf("Invalid Script %s", txCollateral.ToString());
LogPrintf ("CBudgetProposal::IsCollateralValid - %s\n", strError);
LogPrintf ("CGovernanceObject::IsCollateralValid - %s\n", strError);
return false;
}
if(o.scriptPubKey == findScript && o.nValue >= minFee) foundOpReturn = true;
@ -56,7 +56,7 @@ bool IsCollateralValid(uint256 nTxCollateralHash, uint256 nExpectedHash, std::st
}
if(!foundOpReturn){
strError = strprintf("Couldn't find opReturn %s in %s", nExpectedHash.ToString(), txCollateral.ToString());
LogPrintf ("CBudgetProposal::IsCollateralValid - %s\n", strError);
LogPrintf ("CGovernanceObject::IsCollateralValid - %s\n", strError);
return false;
}
@ -80,7 +80,7 @@ bool IsCollateralValid(uint256 nTxCollateralHash, uint256 nExpectedHash, std::st
return true;
} else {
strError = strprintf("Collateral requires at least %d confirmations - %d confirmations", BUDGET_FEE_CONFIRMATIONS, conf);
LogPrintf ("CBudgetProposal::IsCollateralValid - %s - %d confirmations\n", strError, conf);
LogPrintf ("CGovernanceObject::IsCollateralValid - %s - %d confirmations\n", strError, conf);
return false;
}
}
@ -101,7 +101,7 @@ void CGovernanceManager::CheckOrphanVotes()
}
}
bool CGovernanceManager::AddProposal(CBudgetProposal& budgetProposal)
bool CGovernanceManager::AddProposal(CGovernanceObject& budgetProposal)
{
LOCK(cs);
std::string strError = "";
@ -126,23 +126,23 @@ void CGovernanceManager::CheckAndRemove()
std::string strError = "";
std::map<uint256, CBudgetProposal>::iterator it2 = mapProposals.begin();
std::map<uint256, CGovernanceObject>::iterator it2 = mapProposals.begin();
while(it2 != mapProposals.end())
{
CBudgetProposal* pbudgetProposal = &((*it2).second);
CGovernanceObject* pbudgetProposal = &((*it2).second);
pbudgetProposal->fValid = pbudgetProposal->IsValid(pCurrentBlockIndex, strError);
++it2;
}
}
CBudgetProposal *CGovernanceManager::FindProposal(const std::string &strName)
CGovernanceObject *CGovernanceManager::FindProposal(const std::string &strName)
{
//find the prop with the highest yes count
int nYesCount = -99999;
CBudgetProposal* pbudgetProposal = NULL;
CGovernanceObject* pbudgetProposal = NULL;
std::map<uint256, CBudgetProposal>::iterator it = mapProposals.begin();
std::map<uint256, CGovernanceObject>::iterator it = mapProposals.begin();
while(it != mapProposals.end()){
if((*it).second.strName == strName && (*it).second.GetYesCount() > nYesCount){
pbudgetProposal = &((*it).second);
@ -156,7 +156,7 @@ CBudgetProposal *CGovernanceManager::FindProposal(const std::string &strName)
return pbudgetProposal;
}
CBudgetProposal *CGovernanceManager::FindProposal(uint256 nHash)
CGovernanceObject *CGovernanceManager::FindProposal(uint256 nHash)
{
LOCK(cs);
@ -166,18 +166,18 @@ CBudgetProposal *CGovernanceManager::FindProposal(uint256 nHash)
return NULL;
}
std::vector<CBudgetProposal*> CGovernanceManager::GetAllProposals()
std::vector<CGovernanceObject*> CGovernanceManager::GetAllProposals()
{
LOCK(cs);
std::vector<CBudgetProposal*> vBudgetProposalRet;
std::vector<CGovernanceObject*> vBudgetProposalRet;
std::map<uint256, CBudgetProposal>::iterator it = mapProposals.begin();
std::map<uint256, CGovernanceObject>::iterator it = mapProposals.begin();
while(it != mapProposals.end())
{
(*it).second.CleanAndRemove(false);
CBudgetProposal* pbudgetProposal = &((*it).second);
CGovernanceObject* pbudgetProposal = &((*it).second);
vBudgetProposalRet.push_back(pbudgetProposal);
++it;
@ -190,7 +190,7 @@ std::vector<CBudgetProposal*> CGovernanceManager::GetAllProposals()
// Sort by votes, if there's a tie sort by their feeHash TX
//
struct sortProposalsByVotes {
bool operator()(const std::pair<CBudgetProposal*, int> &left, const std::pair<CBudgetProposal*, int> &right) {
bool operator()(const std::pair<CGovernanceObject*, int> &left, const std::pair<CGovernanceObject*, int> &right) {
if( left.second != right.second)
return (left.second > right.second);
return (UintToArith256(left.first->nFeeTXHash) > UintToArith256(right.first->nFeeTXHash));
@ -250,13 +250,13 @@ void CGovernanceManager::NewBlock()
}
}
std::map<uint256, CBudgetProposal>::iterator it2 = mapProposals.begin();
std::map<uint256, CGovernanceObject>::iterator it2 = mapProposals.begin();
while(it2 != mapProposals.end()){
(*it2).second.CleanAndRemove(false);
++it2;
}
std::vector<CBudgetProposal>::iterator it4 = vecImmatureBudgetProposals.begin();
std::vector<CGovernanceObject>::iterator it4 = vecImmatureBudgetProposals.begin();
while(it4 != vecImmatureBudgetProposals.end())
{
std::string strError = "";
@ -273,7 +273,7 @@ void CGovernanceManager::NewBlock()
// continue;
// }
// CBudgetProposal budgetProposal((*it4));
// CGovernanceObject budgetProposal((*it4));
// if(AddProposal(budgetProposal)) {(*it4).Relay();}
// LogPrintf("mprop (immature) - new budget - %s\n", (*it4).GetHash().ToString());
@ -313,7 +313,7 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, std::string& strCommand, C
// todo - 12.1 - change to MNGOVERNANCEPROPOSAL
if (strCommand == NetMsgType::MNBUDGETPROPOSAL) { //Masternode Proposal
CBudgetProposal budgetProposalBroadcast;
CGovernanceObject budgetProposalBroadcast;
vRecv >> budgetProposalBroadcast;
if(mapSeenMasternodeBudgetProposals.count(budgetProposalBroadcast.GetHash())){
@ -336,7 +336,7 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, std::string& strCommand, C
return;
}
CBudgetProposal budgetProposal(budgetProposalBroadcast);
CGovernanceObject budgetProposal(budgetProposalBroadcast);
if(AddProposal(budgetProposal)) {budgetProposalBroadcast.Relay();}
masternodeSync.AddedBudgetItem(budgetProposalBroadcast.GetHash());
@ -448,9 +448,9 @@ void CGovernanceManager::Sync(CNode* pfrom, uint256 nProp)
int nInvCount = 0;
// sync gov objects
std::map<uint256, CBudgetProposal>::iterator it1 = mapSeenMasternodeBudgetProposals.begin();
std::map<uint256, CGovernanceObject>::iterator it1 = mapSeenMasternodeBudgetProposals.begin();
while(it1 != mapSeenMasternodeBudgetProposals.end()){
CBudgetProposal* pbudgetProposal = FindProposal((*it1).first);
CGovernanceObject* pbudgetProposal = FindProposal((*it1).first);
if(pbudgetProposal && pbudgetProposal->fValid && ((nProp == uint256() || ((*it1).first == nProp)))){
// Push the inventory budget proposal message over to the other client
pfrom->PushInventory(CInv(MSG_BUDGET_PROPOSAL, (*it1).second.GetHash()));
@ -513,12 +513,12 @@ bool CGovernanceManager::AddOrUpdateVote(CBudgetVote& vote, std::string& strErro
if(mapVotes[hash2].count(hash)){
if(mapVotes[hash2][hash].nTime > vote.nTime){
strError = strprintf("new vote older than existing vote - %s", vote.GetHash().ToString());
LogPrint("mnbudget", "CBudgetProposal::AddOrUpdateVote - %s\n", strError);
LogPrint("mnbudget", "CGovernanceObject::AddOrUpdateVote - %s\n", strError);
return false;
}
if(vote.nTime - mapVotes[hash2][hash].nTime < BUDGET_VOTE_UPDATE_MIN){
strError = strprintf("time between votes is too soon - %s - %lli", vote.GetHash().ToString(), vote.nTime - mapVotes[hash2][hash].nTime);
LogPrint("mnbudget", "CBudgetProposal::AddOrUpdateVote - %s\n", strError);
LogPrint("mnbudget", "CGovernanceObject::AddOrUpdateVote - %s\n", strError);
return false;
}
}
@ -527,7 +527,7 @@ bool CGovernanceManager::AddOrUpdateVote(CBudgetVote& vote, std::string& strErro
return true;
}
CBudgetProposal::CBudgetProposal()
CGovernanceObject::CGovernanceObject()
{
strName = "unknown";
nStartTime = 0;
@ -537,7 +537,7 @@ CBudgetProposal::CBudgetProposal()
fValid = true;
}
CBudgetProposal::CBudgetProposal(const CBudgetProposal& other)
CGovernanceObject::CGovernanceObject(const CGovernanceObject& other)
{
strName = other.strName;
strURL = other.strURL;
@ -550,7 +550,7 @@ CBudgetProposal::CBudgetProposal(const CBudgetProposal& other)
fValid = true;
}
CBudgetProposal::CBudgetProposal(std::string strNameIn, std::string strURLIn, int nPaymentCount, CScript addressIn, CAmount nAmountIn, int64_t nStartTimeIn, int64_t nEndTimeIn, uint256 nFeeTXHashIn)
CGovernanceObject::CGovernanceObject(std::string strNameIn, std::string strURLIn, int nPaymentCount, CScript addressIn, CAmount nAmountIn, int64_t nStartTimeIn, int64_t nEndTimeIn, uint256 nFeeTXHashIn)
{
strName = strNameIn;
strURL = strURLIn;
@ -561,7 +561,7 @@ CBudgetProposal::CBudgetProposal(std::string strNameIn, std::string strURLIn, in
nFeeTXHash = nFeeTXHashIn;
}
bool CBudgetProposal::IsValid(const CBlockIndex* pindex, std::string& strError, bool fCheckCollateral)
bool CGovernanceObject::IsValid(const CBlockIndex* pindex, std::string& strError, bool fCheckCollateral)
{
if(GetNoCount() - GetYesCount() > mnodeman.CountEnabled(MIN_BUDGET_PEER_PROTO_VERSION)/10){
strError = "Active removal";
@ -648,7 +648,7 @@ bool CBudgetProposal::IsValid(const CBlockIndex* pindex, std::string& strError,
return true;
}
bool CBudgetProposal::NetworkWillPay()
bool CGovernanceObject::NetworkWillPay()
{
/**
* vote nVoteType 1 to 10
@ -671,7 +671,7 @@ bool CBudgetProposal::NetworkWillPay()
return true;
}
bool CBudgetProposal::IsEstablished() {
bool CGovernanceObject::IsEstablished() {
//Proposals must be established to make it into a budget
return (nTime < GetTime() - Params().GetConsensus().nBudgetProposalEstablishingTime);
}
@ -702,27 +702,27 @@ void CGovernanceManager::CleanAndRemove(bool fSignatureCheck)
}
}
int CBudgetProposal::GetAbsoluteYesCount()
int CGovernanceObject::GetAbsoluteYesCount()
{
return governance.CountMatchingVotes(VOTE_TYPE_FUND, VOTE_OUTCOME_YES) - governance.CountMatchingVotes(VOTE_TYPE_FUND, VOTE_OUTCOME_NO);
}
int CBudgetProposal::GetYesCount()
int CGovernanceObject::GetYesCount()
{
return governance.CountMatchingVotes(VOTE_TYPE_FUND, VOTE_OUTCOME_YES);
}
int CBudgetProposal::GetNoCount()
int CGovernanceObject::GetNoCount()
{
return governance.CountMatchingVotes(VOTE_TYPE_FUND, VOTE_OUTCOME_NO);
}
int CBudgetProposal::GetAbstainCount()
int CGovernanceObject::GetAbstainCount()
{
return governance.CountMatchingVotes(VOTE_TYPE_FUND, VOTE_OUTCOME_ABSTAIN);
}
void CBudgetProposal::Relay()
void CGovernanceObject::Relay()
{
CInv inv(MSG_BUDGET_PROPOSAL, GetHash());
RelayInv(inv, MIN_BUDGET_PEER_PROTO_VERSION);
@ -777,3 +777,9 @@ int CGovernanceManager::CountMatchingVotes(int nVoteTypeIn, int nVoteOutcomeIn)
return nMatching;
}
// template<typename T>
// bool CGovernanceManager::AddRegister(T& newValue)
// {
// }

View File

@ -16,6 +16,9 @@
#include <boost/lexical_cast.hpp>
#include "init.h"
#include <stdio.h>
#include <string.h>
using namespace std;
extern CCriticalSection cs_budget;
@ -28,7 +31,7 @@ static const int64_t CONTRACT_ACTIVATION_TIME = 60*60*24*14;
class CGovernanceManager;
class CBudgetProposal;
class CGovernanceObject;
class CBudgetVote;
class CNode;
@ -37,7 +40,7 @@ static const CAmount GOVERNANCE_FEE_TX = (5*COIN);
static const int64_t GOVERNANCE_FEE_CONFIRMATIONS = 6;
static const int64_t GOVERNANCE_UPDATE_MIN = 60*60;
extern std::vector<CBudgetProposal> vecImmatureBudgetProposals;
extern std::vector<CGovernanceObject> vecImmatureBudgetProposals;
extern std::map<uint256, int64_t> askedForSourceProposalOrBudget;
extern CGovernanceManager governance;
@ -62,10 +65,10 @@ public:
mutable CCriticalSection cs;
// keep track of the scanning errors I've seen
map<uint256, CBudgetProposal> mapProposals;
map<uint256, CGovernanceObject> mapProposals;
// todo - 12.1 - move to private for better encapsulation
std::map<uint256, CBudgetProposal> mapSeenMasternodeBudgetProposals;
std::map<uint256, CGovernanceObject> mapSeenMasternodeBudgetProposals;
std::map<uint256, CBudgetVote> mapSeenMasternodeBudgetVotes;
std::map<uint256, CBudgetVote> mapOrphanMasternodeBudgetVotes;
// parent hash vote hash vote
@ -97,13 +100,13 @@ public:
void ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
void NewBlock();
CBudgetProposal *FindProposal(const std::string &strName);
CBudgetProposal *FindProposal(uint256 nHash);
CGovernanceObject *FindProposal(const std::string &strName);
CGovernanceObject *FindProposal(uint256 nHash);
std::vector<CBudgetProposal*> GetAllProposals();
std::vector<CGovernanceObject*> GetAllProposals();
bool IsBudgetPaymentBlock(int nBlockHeight);
bool AddProposal(CBudgetProposal& budgetProposal);
bool AddProposal(CGovernanceObject& budgetProposal);
bool UpdateProposal(CBudgetVote& vote, CNode* pfrom, std::string& strError);
bool AddOrUpdateVote(CBudgetVote& vote, std::string& strError);
bool PropExists(uint256 nHash);
@ -139,47 +142,41 @@ public:
};
/**
* Governance objects can hold any time of data
* Governance objects can hold any type of data
* --------------------------------------------
*
*
*/
// todo - 12.1 - add register obj to CGovernanceObj
// union GovernanceObjectRegister
// {
// CAmount a;
// int i;
// bool b;
// double f;
// std::string s;
// uint256 h;
// CBitcoinAddress ba;
// }
class CGovernanceObjectRegister
{
private:
int nType;
std::string strReg;
public:
CGovernanceObjectRegister(int nTypeIn, char* strRegIn)
{
nType = nTypeIn;
strReg = strRegIn;
}
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
//for syncing with other clients
READWRITE(nType);
READWRITE(LIMITED_STRING(strReg, 64));
}
};
/**
* Governance object payload types
* --------------------------------------------
* Generic Governance Object
*
*
*/
// todo - 12.1 - add payload obj to CGovernanceObj
// enum class GovernanceObjectPayloadType {
// CAmount,
// Int,
// Bool,
// String,
// Double,
// Hash256,
// BitcoinAddress
// };
//
// Budget Proposal : Contains the masternode votes for each budget
//
class CBudgetProposal
class CGovernanceObject
{
private:
// critical section to protect the inner data structures
@ -188,22 +185,28 @@ private:
public:
bool fValid;
std::string strName;
std::string strName; //org name, username, prop name, etc.
std::string strURL;
int nStartTime;
int nEndTime;
CAmount nAmount; // 12.1 - remove
// int nPriority; //budget is sorted by this integer before funding votecount
int nPriority; //budget is sorted by this integer before funding votecount
CScript address; //todo rename to addressOwner;
int64_t nTime;
uint256 nFeeTXHash;
uint256 nHashParent; // 12.1 - remove
// Registers, these can be used for anything by the masternode network
// vector<GovernanceObjectPayloadType> registerTypes;
// vector<GovernanceObjectPayload> registers;
// Registers, these can be used for anything
// -- check governance wiki for correct usage
std::map<int, CGovernanceObjectRegister> mapRegister;
/**
* Example usage:
* --------------------------------------------------------
*
* We don't really care what's in these, as long as the masternode network
* believes they're accurate. Otherwise the masternodes will vote them down
* and we'll delete them from memory (fee-loss attack).
*
* - This system is designed to allow virtually any usage
* - No protocol changes are needed
@ -216,14 +219,31 @@ public:
* Proposal:
* MasternodePaymentsBlock: BlockStart, Masternode1, 2, 3...
* Arbitration: UserId1, UserId2, TxHash, ContractHash
*/
bool AddRegister(std::string& strError, int nTypeIn, std::string strIn)
{
if(strIn.size() > 64)
{
strError = "Too big.";
return false;
}
char regbuff[64];
strncpy(regbuff, strIn.c_str(), sizeof(regbuff));
CGovernanceObjectRegister newRegister(nTypeIn, regbuff);
mapRegister.insert(make_pair(1 , newRegister));
return true;
}
//cache object
CBudgetProposal();
CBudgetProposal(const CBudgetProposal& other);
CBudgetProposal(std::string strNameIn, std::string strURLIn, int nPaymentCount, CScript addressIn, CAmount nAmountIn, int64_t nStartTimeIn, int64_t nEndTimeIn, uint256 nFeeTXHashIn);
CGovernanceObject();
CGovernanceObject(const CGovernanceObject& other);
CGovernanceObject(std::string strNameIn, std::string strURLIn, int64_t nStartTimeIn, int64_t nEndTimeIn, uint256 nFeeTXHashIn);
bool HasMinimumRequiredSupport();
bool IsValid(const CBlockIndex* pindex, std::string& strError, bool fCheckCollateral=true);
@ -234,13 +254,11 @@ public:
std::string GetURL() {return strURL; }
int GetStartTime() {return nStartTime;}
int GetEndTime() {return nEndTime;}
CScript GetPayee() {return address;}
int IsActive(int64_t nTime) {return nTime > nStartTime && nTime < nEndTime;}
int GetAbsoluteYesCount();
int GetYesCount();
int GetNoCount();
int GetAbstainCount();
CAmount GetAmount() {return nAmount;}
void CleanAndRemove(bool fSignatureCheck);
@ -250,8 +268,7 @@ public:
ss << strURL;
ss << nStartTime;
ss << nEndTime;
ss << nAmount;
ss << *(CScriptBase*)(&address);
ss << mapRegister;
uint256 h1 = ss.GetHash();
return h1;
@ -268,10 +285,7 @@ public:
READWRITE(nTime);
READWRITE(nStartTime);
READWRITE(nEndTime);
READWRITE(nAmount);
READWRITE(*(CScriptBase*)(&address));
READWRITE(nTime);
READWRITE(mapRegister);
READWRITE(nFeeTXHash);
}
};

View File

@ -35,7 +35,7 @@ struct sortFinalizedBudgetsByVotes {
// Sort by votes, if there's a tie sort by their feeHash TX
//
struct sortProposalsByVotes {
bool operator()(const std::pair<CBudgetProposal*, int> &left, const std::pair<CBudgetProposal*, int> &right) {
bool operator()(const std::pair<CGovernanceObject*, int> &left, const std::pair<CGovernanceObject*, int> &right) {
if( left.second != right.second)
return (left.second > right.second);
return (UintToArith256(left.first->nFeeTXHash) > UintToArith256(right.first->nFeeTXHash));
@ -700,7 +700,7 @@ void CFinalizedBudget::AutoCheck()
if(strBudgetMode == "auto") //only vote for exact matches
{
std::vector<CBudgetProposal*> vBudgetProposals = budget.GetBudget();
std::vector<CGovernanceObject*> vBudgetProposals = budget.GetBudget();
for(unsigned int i = 0; i < vecBudgetPayments.size(); i++){
@ -783,7 +783,7 @@ std::string CFinalizedBudget::GetProposals()
std::string ret = "";
BOOST_FOREACH(CTxBudgetPayment& budgetPayment, vecBudgetPayments){
CBudgetProposal* pbudgetProposal = governance.FindProposal(budgetPayment.nProposalHash);
CGovernanceObject* pbudgetProposal = governance.FindProposal(budgetPayment.nProposalHash);
std::string token = budgetPayment.nProposalHash.ToString();
@ -807,7 +807,7 @@ std::string CFinalizedBudget::GetStatus()
continue;
}
CBudgetProposal* pbudgetProposal = governance.FindProposal(budgetPayment.nProposalHash);
CGovernanceObject* pbudgetProposal = governance.FindProposal(budgetPayment.nProposalHash);
if(!pbudgetProposal){
if(retBadHashes == ""){
retBadHashes = "Unknown proposal hash! Check this proposal before voting" + budgetPayment.nProposalHash.ToString();

View File

@ -95,7 +95,7 @@ UniValue mnbudget(const UniValue& params, bool fHelp)
//*************************************************************************
// create transaction 15 minutes into the future, to allow for confirmation time
CBudgetProposal budgetProposalBroadcast(strName, strURL, nPaymentCount, scriptPubKey, nAmount, GetTime(), 253370764800, uint256());
CGovernanceObject budgetProposalBroadcast(strName, strURL, nPaymentCount, scriptPubKey, nAmount, GetTime(), 253370764800, uint256());
std::string strError = "";
if(!budgetProposalBroadcast.IsValid(pindex, strError, false))
@ -158,7 +158,7 @@ UniValue mnbudget(const UniValue& params, bool fHelp)
uint256 hash = ParseHashV(params[7], "Proposal hash");
//create the proposal incase we're the first to make it
CBudgetProposal budgetProposalBroadcast(strName, strURL, nPaymentCount, scriptPubKey, nAmount, GetTime(), 253370764800, hash);
CGovernanceObject budgetProposalBroadcast(strName, strURL, nPaymentCount, scriptPubKey, nAmount, GetTime(), 253370764800, hash);
std::string strError = "";
@ -416,8 +416,8 @@ UniValue mnbudget(const UniValue& params, bool fHelp)
pindex = chainActive.Tip();
}
std::vector<CBudgetProposal*> winningProps = governance.GetAllProposals();
BOOST_FOREACH(CBudgetProposal* pbudgetProposal, winningProps)
std::vector<CGovernanceObject*> winningProps = governance.GetAllProposals();
BOOST_FOREACH(CGovernanceObject* pbudgetProposal, winningProps)
{
if(strShow == "valid" && !pbudgetProposal->fValid) continue;
@ -458,15 +458,15 @@ UniValue mnbudget(const UniValue& params, bool fHelp)
std::string strName = SanitizeString(params[1].get_str());
CBudgetProposal* pbudgetProposal = governance.FindProposal(strName);
CGovernanceObject* pbudgetProposal = governance.FindProposal(strName);
if(pbudgetProposal == NULL)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Unknown proposal");
UniValue resultObj(UniValue::VOBJ);
std::vector<CBudgetProposal*> winningProps = governance.GetAllProposals();
BOOST_FOREACH(CBudgetProposal* pbudgetProposal, winningProps)
std::vector<CGovernanceObject*> winningProps = governance.GetAllProposals();
BOOST_FOREACH(CGovernanceObject* pbudgetProposal, winningProps)
{
if(pbudgetProposal->GetName() != strName) continue;
if(!pbudgetProposal->fValid) continue;
@ -490,7 +490,7 @@ UniValue mnbudget(const UniValue& params, bool fHelp)
uint256 hash = ParseHashV(params[1], "Proposal hash");
CBudgetProposal* pbudgetProposal = governance.FindProposal(hash);
CGovernanceObject* pbudgetProposal = governance.FindProposal(hash);
if(pbudgetProposal == NULL)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Unknown proposal");
@ -538,7 +538,7 @@ UniValue mnbudget(const UniValue& params, bool fHelp)
UniValue obj(UniValue::VOBJ);
CBudgetProposal* pbudgetProposal = governance.FindProposal(hash);
CGovernanceObject* pbudgetProposal = governance.FindProposal(hash);
if(pbudgetProposal == NULL)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Unknown proposal");