fix CGovernanceObject step1.5: not really a fix, just commented out simple broken parts (undeclared vars and functions, wrong number of arguments etc) to prove that it compiles now, needs to be actually fixed
This commit is contained in:
parent
71bdc09470
commit
26b8d99be2
@ -20,8 +20,8 @@
|
|||||||
|
|
||||||
CBudgetVote::CBudgetVote()
|
CBudgetVote::CBudgetVote()
|
||||||
{
|
{
|
||||||
vin = CTxIn();
|
// vin = CTxIn();
|
||||||
nProposalHash = uint256();
|
// nProposalHash = uint256();
|
||||||
nVoteAction = VOTE_ACTION_NONE;
|
nVoteAction = VOTE_ACTION_NONE;
|
||||||
nVoteOutcome = VOTE_OUTCOME_NONE;
|
nVoteOutcome = VOTE_OUTCOME_NONE;
|
||||||
nTime = 0;
|
nTime = 0;
|
||||||
@ -31,8 +31,8 @@ CBudgetVote::CBudgetVote()
|
|||||||
|
|
||||||
CBudgetVote::CBudgetVote(CTxIn vinIn, uint256 nProposalHashIn, int nVoteActionIn, int nVoteOutcomeIn)
|
CBudgetVote::CBudgetVote(CTxIn vinIn, uint256 nProposalHashIn, int nVoteActionIn, int nVoteOutcomeIn)
|
||||||
{
|
{
|
||||||
vin = vinIn;
|
// vin = vinIn;
|
||||||
nProposalHash = nProposalHashIn;
|
// nProposalHash = nProposalHashIn;
|
||||||
nVoteAction = nVoteActionIn;
|
nVoteAction = nVoteActionIn;
|
||||||
nVoteOutcome = nVoteOutcomeIn;
|
nVoteOutcome = nVoteOutcomeIn;
|
||||||
nTime = GetAdjustedTime();
|
nTime = GetAdjustedTime();
|
||||||
@ -53,17 +53,17 @@ bool CBudgetVote::Sign(CKey& keyMasternode, CPubKey& pubKeyMasternode)
|
|||||||
CKey keyCollateralAddress;
|
CKey keyCollateralAddress;
|
||||||
|
|
||||||
std::string errorMessage;
|
std::string errorMessage;
|
||||||
std::string strMessage = vin.prevout.ToStringShort() + nProposalHash.ToString() + boost::lexical_cast<std::string>(nVote) + boost::lexical_cast<std::string>(nTime);
|
// std::string strMessage = vin.prevout.ToStringShort() + nProposalHash.ToString() + boost::lexical_cast<std::string>(nVote) + boost::lexical_cast<std::string>(nTime);
|
||||||
|
|
||||||
if(!darkSendSigner.SignMessage(strMessage, errorMessage, vchSig, keyMasternode)) {
|
// if(!darkSendSigner.SignMessage(strMessage, errorMessage, vchSig, keyMasternode)) {
|
||||||
LogPrintf("CBudgetVote::Sign - Error upon calling SignMessage");
|
// LogPrintf("CBudgetVote::Sign - Error upon calling SignMessage");
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(!darkSendSigner.VerifyMessage(pubKeyMasternode, vchSig, strMessage, errorMessage)) {
|
// if(!darkSendSigner.VerifyMessage(pubKeyMasternode, vchSig, strMessage, errorMessage)) {
|
||||||
LogPrintf("CBudgetVote::Sign - Error upon calling VerifyMessage");
|
// LogPrintf("CBudgetVote::Sign - Error upon calling VerifyMessage");
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -89,22 +89,22 @@ bool CBudgetVote::IsValid(bool fSignatureCheck)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMasternode* pmn = mnodeman.Find(vin);
|
// CMasternode* pmn = mnodeman.Find(vin);
|
||||||
if(pmn == NULL)
|
// if(pmn == NULL)
|
||||||
{
|
// {
|
||||||
LogPrint("mngovernance", "CBudgetVote::IsValid() - Unknown Masternode - %s\n", vin.ToString());
|
// LogPrint("mngovernance", "CBudgetVote::IsValid() - Unknown Masternode - %s\n", vin.ToString());
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(!fSignatureCheck) return true;
|
if(!fSignatureCheck) return true;
|
||||||
|
|
||||||
std::string errorMessage;
|
std::string errorMessage;
|
||||||
std::string strMessage = vin.prevout.ToStringShort() + nProposalHash.ToString() + boost::lexical_cast<std::string>(nVote) + boost::lexical_cast<std::string>(nTime);
|
// std::string strMessage = vin.prevout.ToStringShort() + nProposalHash.ToString() + boost::lexical_cast<std::string>(nVote) + boost::lexical_cast<std::string>(nTime);
|
||||||
|
|
||||||
if(!darkSendSigner.VerifyMessage(pmn->pubkey2, vchSig, strMessage, errorMessage)) {
|
// if(!darkSendSigner.VerifyMessage(pmn->pubkey2, vchSig, strMessage, errorMessage)) {
|
||||||
LogPrintf("CBudgetVote::IsValid() - Verify message failed - Error: %s\n", errorMessage);
|
// LogPrintf("CBudgetVote::IsValid() - Verify message failed - Error: %s\n", errorMessage);
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
@ -551,10 +551,10 @@ CGovernanceObject::CGovernanceObject(uint256 nHashParentIn, int nRevisionIn, std
|
|||||||
nTime = 0;
|
nTime = 0;
|
||||||
|
|
||||||
nHashParent = nHashParentIn; //parent object, 0 is root
|
nHashParent = nHashParentIn; //parent object, 0 is root
|
||||||
nPriority = nPriorityIn;
|
// nPriority = nPriorityIn;
|
||||||
nRevision = nRevisionIn; //object revision in the system
|
nRevision = nRevisionIn; //object revision in the system
|
||||||
nFeeTXHash = nFeeTXHashIn; //fee-tx
|
nFeeTXHash = nFeeTXHashIn; //fee-tx
|
||||||
nTypeVersion = nTypeVersionIn;
|
// nTypeVersion = nTypeVersionIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGovernanceObject::CGovernanceObject(const CGovernanceObject& other)
|
CGovernanceObject::CGovernanceObject(const CGovernanceObject& other)
|
||||||
@ -578,20 +578,20 @@ bool CGovernanceObject::IsValid(const CBlockIndex* pindex, std::string& strError
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nEndTime < GetTime()) {
|
// if(nEndTime < GetTime()) {
|
||||||
strError = "Expired Proposal";
|
// strError = "Expired Proposal";
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(!pindex) {
|
if(!pindex) {
|
||||||
strError = "Tip is NULL";
|
strError = "Tip is NULL";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nAmount < 10000) {
|
// if(nAmount < 10000) {
|
||||||
strError = "Invalid proposal amount (minimum 10000)";
|
// strError = "Invalid proposal amount (minimum 10000)";
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(strName.size() > 20) {
|
if(strName.size() > 20) {
|
||||||
strError = "Invalid proposal name, limit of 20 characters.";
|
strError = "Invalid proposal name, limit of 20 characters.";
|
||||||
@ -603,10 +603,10 @@ bool CGovernanceObject::IsValid(const CBlockIndex* pindex, std::string& strError
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(address == CScript()) {
|
// if(address == CScript()) {
|
||||||
strError = "Invalid proposal Payment Address";
|
// strError = "Invalid proposal Payment Address";
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 12.1 - add valid predicates
|
// 12.1 - add valid predicates
|
||||||
// this can be handled by configuration
|
// this can be handled by configuration
|
||||||
@ -633,10 +633,10 @@ bool CGovernanceObject::IsValid(const CBlockIndex* pindex, std::string& strError
|
|||||||
/*
|
/*
|
||||||
TODO: There might be an issue with multisig in the coinbase on mainnet, we will add support for it in a future release.
|
TODO: There might be an issue with multisig in the coinbase on mainnet, we will add support for it in a future release.
|
||||||
*/
|
*/
|
||||||
if(address.IsPayToScriptHash()) {
|
// if(address.IsPayToScriptHash()) {
|
||||||
strError = "Multisig is not currently supported.";
|
// strError = "Multisig is not currently supported.";
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 12.1 move to pybrain
|
// 12.1 move to pybrain
|
||||||
// //can only pay out 10% of the possible coins (min value of coins)
|
// //can only pay out 10% of the possible coins (min value of coins)
|
||||||
@ -663,10 +663,10 @@ bool CGovernanceObject::NetworkWillPay()
|
|||||||
std::string strError = "";
|
std::string strError = "";
|
||||||
|
|
||||||
// -- If GetAbsoluteYesCount is more than -10% of the network, flag as invalid
|
// -- If GetAbsoluteYesCount is more than -10% of the network, flag as invalid
|
||||||
if(GetAbsoluteYesCount() < -(mnodeman.CountEnabled(MIN_BUDGET_PEER_PROTO_VERSION)/10)) {
|
// if(GetAbsoluteYesCount() < -(mnodeman.CountEnabled(MIN_BUDGET_PEER_PROTO_VERSION)/10)) {
|
||||||
strError = "Voted Down";
|
// strError = "Voted Down";
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -773,9 +773,9 @@ int CGovernanceManager::CountMatchingVotes(int nVoteTypeIn, int nVoteOutcomeIn)
|
|||||||
{
|
{
|
||||||
if(!(*it3).second.IsValid(true))
|
if(!(*it3).second.IsValid(true))
|
||||||
{
|
{
|
||||||
if((*it3).second.nVoteType == nVoteTypeIn &&
|
// if((*it3).second.nVoteType == nVoteTypeIn &&
|
||||||
(*it3).second.nVoteOutcome == nVoteOutcomeIn)
|
// (*it3).second.nVoteOutcome == nVoteOutcomeIn)
|
||||||
nMatching++;
|
// nMatching++;
|
||||||
} else {
|
} else {
|
||||||
++it3;
|
++it3;
|
||||||
}
|
}
|
||||||
|
@ -157,10 +157,10 @@ UniValue mngovernance(const UniValue& params, bool fHelp)
|
|||||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Proposal is not valid - " + budgetProposalBroadcast.GetHash().ToString() + " - " + strError);
|
throw JSONRPCError(RPC_INTERNAL_ERROR, "Proposal is not valid - " + budgetProposalBroadcast.GetHash().ToString() + " - " + strError);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nConf = 0;
|
// int nConf = 0;
|
||||||
if(!IsCollateralValid(hash, budgetProposalBroadcast.GetHash(), strError, budgetProposalBroadcast.nTime, nConf, GOVERNANCE_FEE_TX)){
|
// if(!IsCollateralValid(hash, budgetProposalBroadcast.GetHash(), strError, budgetProposalBroadcast.nTime, nConf, GOVERNANCE_FEE_TX)){
|
||||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Proposal FeeTX is not valid - " + hash.ToString() + " - " + strError);
|
// throw JSONRPCError(RPC_INTERNAL_ERROR, "Proposal FeeTX is not valid - " + hash.ToString() + " - " + strError);
|
||||||
}
|
// }
|
||||||
|
|
||||||
governance.mapSeenMasternodeBudgetProposals.insert(make_pair(budgetProposalBroadcast.GetHash(), budgetProposalBroadcast));
|
governance.mapSeenMasternodeBudgetProposals.insert(make_pair(budgetProposalBroadcast.GetHash(), budgetProposalBroadcast));
|
||||||
budgetProposalBroadcast.Relay();
|
budgetProposalBroadcast.Relay();
|
||||||
@ -288,15 +288,15 @@ UniValue mngovernance(const UniValue& params, bool fHelp)
|
|||||||
bObj.push_back(Pair("Name", pbudgetProposal->GetName()));
|
bObj.push_back(Pair("Name", pbudgetProposal->GetName()));
|
||||||
bObj.push_back(Pair("Hash", pbudgetProposal->GetHash().ToString()));
|
bObj.push_back(Pair("Hash", pbudgetProposal->GetHash().ToString()));
|
||||||
bObj.push_back(Pair("FeeTXHash", pbudgetProposal->nFeeTXHash.ToString()));
|
bObj.push_back(Pair("FeeTXHash", pbudgetProposal->nFeeTXHash.ToString()));
|
||||||
bObj.push_back(Pair("StartTime", (int64_t)pbudgetProposal->GetStartTime()));
|
// bObj.push_back(Pair("StartTime", (int64_t)pbudgetProposal->GetStartTime()));
|
||||||
bObj.push_back(Pair("EndTime", (int64_t)pbudgetProposal->GetEndTime()));
|
// bObj.push_back(Pair("EndTime", (int64_t)pbudgetProposal->GetEndTime()));
|
||||||
|
|
||||||
// vote data for funding
|
// vote data for funding
|
||||||
bObj.push_back(Pair("AbsoluteYesCount", (int64_t)pbudgetProposal->GetYesCount(VOTE_ACTION_FUNDING)-(int64_t)pbudgetProposal->GetNoCount(VOTE_ACTION_FUNDING)));
|
bObj.push_back(Pair("AbsoluteYesCount", (int64_t)pbudgetProposal->GetYesCount(VOTE_ACTION_FUNDING)-(int64_t)pbudgetProposal->GetNoCount(VOTE_ACTION_FUNDING)));
|
||||||
bObj.push_back(Pair("YesCount", (int64_t)pbudgetProposal->GetYesCount(VOTE_ACTION_FUNDING)));
|
bObj.push_back(Pair("YesCount", (int64_t)pbudgetProposal->GetYesCount(VOTE_ACTION_FUNDING)));
|
||||||
bObj.push_back(Pair("NoCount", (int64_t)pbudgetProposal->GetNoCount(VOTE_ACTION_FUNDING)));
|
bObj.push_back(Pair("NoCount", (int64_t)pbudgetProposal->GetNoCount(VOTE_ACTION_FUNDING)));
|
||||||
bObj.push_back(Pair("AbstainCount", (int64_t)pbudgetProposal->GetAbstainCount(VOTE_ACTION_FUNDING)));
|
bObj.push_back(Pair("AbstainCount", (int64_t)pbudgetProposal->GetAbstainCount(VOTE_ACTION_FUNDING)));
|
||||||
bObj.push_back(Pair("IsEstablished", pbudgetProposal->IsEstablished(VOTE_ACTION_FUNDING)));
|
// bObj.push_back(Pair("IsEstablished", pbudgetProposal->IsEstablished(VOTE_ACTION_FUNDING)));
|
||||||
|
|
||||||
std::string strError = "";
|
std::string strError = "";
|
||||||
bObj.push_back(Pair("IsValid", pbudgetProposal->IsValid(pindex, strError)));
|
bObj.push_back(Pair("IsValid", pbudgetProposal->IsValid(pindex, strError)));
|
||||||
@ -332,12 +332,12 @@ UniValue mngovernance(const UniValue& params, bool fHelp)
|
|||||||
obj.push_back(Pair("Name", pbudgetProposal->GetName()));
|
obj.push_back(Pair("Name", pbudgetProposal->GetName()));
|
||||||
obj.push_back(Pair("Hash", pbudgetProposal->GetHash().ToString()));
|
obj.push_back(Pair("Hash", pbudgetProposal->GetHash().ToString()));
|
||||||
obj.push_back(Pair("FeeTXHash", pbudgetProposal->nFeeTXHash.ToString()));
|
obj.push_back(Pair("FeeTXHash", pbudgetProposal->nFeeTXHash.ToString()));
|
||||||
obj.push_back(Pair("StartTime", (int64_t)pbudgetProposal->GetStartTime()));
|
// obj.push_back(Pair("StartTime", (int64_t)pbudgetProposal->GetStartTime()));
|
||||||
obj.push_back(Pair("EndTime", (int64_t)pbudgetProposal->GetEndTime()));
|
// obj.push_back(Pair("EndTime", (int64_t)pbudgetProposal->GetEndTime()));
|
||||||
obj.push_back(Pair("AbsoluteYesCount", (int64_t)pbudgetProposal->GetYesCount()-(int64_t)pbudgetProposal->GetNoCount()));
|
// obj.push_back(Pair("AbsoluteYesCount", (int64_t)pbudgetProposal->GetYesCount()-(int64_t)pbudgetProposal->GetNoCount()));
|
||||||
obj.push_back(Pair("YesCount", (int64_t)pbudgetProposal->GetYesCount()));
|
// obj.push_back(Pair("YesCount", (int64_t)pbudgetProposal->GetYesCount()));
|
||||||
obj.push_back(Pair("NoCount", (int64_t)pbudgetProposal->GetNoCount()));
|
// obj.push_back(Pair("NoCount", (int64_t)pbudgetProposal->GetNoCount()));
|
||||||
obj.push_back(Pair("AbstainCount", (int64_t)pbudgetProposal->GetAbstainCount()));
|
// obj.push_back(Pair("AbstainCount", (int64_t)pbudgetProposal->GetAbstainCount()));
|
||||||
obj.push_back(Pair("IsEstablished", pbudgetProposal->IsEstablished()));
|
obj.push_back(Pair("IsEstablished", pbudgetProposal->IsEstablished()));
|
||||||
|
|
||||||
std::string strError = "";
|
std::string strError = "";
|
||||||
|
Loading…
Reference in New Issue
Block a user