mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
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()
|
||||
{
|
||||
vin = CTxIn();
|
||||
nProposalHash = uint256();
|
||||
// vin = CTxIn();
|
||||
// nProposalHash = uint256();
|
||||
nVoteAction = VOTE_ACTION_NONE;
|
||||
nVoteOutcome = VOTE_OUTCOME_NONE;
|
||||
nTime = 0;
|
||||
@ -31,8 +31,8 @@ CBudgetVote::CBudgetVote()
|
||||
|
||||
CBudgetVote::CBudgetVote(CTxIn vinIn, uint256 nProposalHashIn, int nVoteActionIn, int nVoteOutcomeIn)
|
||||
{
|
||||
vin = vinIn;
|
||||
nProposalHash = nProposalHashIn;
|
||||
// vin = vinIn;
|
||||
// nProposalHash = nProposalHashIn;
|
||||
nVoteAction = nVoteActionIn;
|
||||
nVoteOutcome = nVoteOutcomeIn;
|
||||
nTime = GetAdjustedTime();
|
||||
@ -53,17 +53,17 @@ bool CBudgetVote::Sign(CKey& keyMasternode, CPubKey& pubKeyMasternode)
|
||||
CKey keyCollateralAddress;
|
||||
|
||||
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)) {
|
||||
LogPrintf("CBudgetVote::Sign - Error upon calling SignMessage");
|
||||
return false;
|
||||
}
|
||||
// if(!darkSendSigner.SignMessage(strMessage, errorMessage, vchSig, keyMasternode)) {
|
||||
// LogPrintf("CBudgetVote::Sign - Error upon calling SignMessage");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if(!darkSendSigner.VerifyMessage(pubKeyMasternode, vchSig, strMessage, errorMessage)) {
|
||||
LogPrintf("CBudgetVote::Sign - Error upon calling VerifyMessage");
|
||||
return false;
|
||||
}
|
||||
// if(!darkSendSigner.VerifyMessage(pubKeyMasternode, vchSig, strMessage, errorMessage)) {
|
||||
// LogPrintf("CBudgetVote::Sign - Error upon calling VerifyMessage");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -89,22 +89,22 @@ bool CBudgetVote::IsValid(bool fSignatureCheck)
|
||||
return false;
|
||||
}
|
||||
|
||||
CMasternode* pmn = mnodeman.Find(vin);
|
||||
if(pmn == NULL)
|
||||
{
|
||||
LogPrint("mngovernance", "CBudgetVote::IsValid() - Unknown Masternode - %s\n", vin.ToString());
|
||||
return false;
|
||||
}
|
||||
// CMasternode* pmn = mnodeman.Find(vin);
|
||||
// if(pmn == NULL)
|
||||
// {
|
||||
// LogPrint("mngovernance", "CBudgetVote::IsValid() - Unknown Masternode - %s\n", vin.ToString());
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if(!fSignatureCheck) return true;
|
||||
|
||||
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)) {
|
||||
LogPrintf("CBudgetVote::IsValid() - Verify message failed - Error: %s\n", errorMessage);
|
||||
return false;
|
||||
}
|
||||
// if(!darkSendSigner.VerifyMessage(pmn->pubkey2, vchSig, strMessage, errorMessage)) {
|
||||
// LogPrintf("CBudgetVote::IsValid() - Verify message failed - Error: %s\n", errorMessage);
|
||||
// return false;
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
@ -551,10 +551,10 @@ CGovernanceObject::CGovernanceObject(uint256 nHashParentIn, int nRevisionIn, std
|
||||
nTime = 0;
|
||||
|
||||
nHashParent = nHashParentIn; //parent object, 0 is root
|
||||
nPriority = nPriorityIn;
|
||||
// nPriority = nPriorityIn;
|
||||
nRevision = nRevisionIn; //object revision in the system
|
||||
nFeeTXHash = nFeeTXHashIn; //fee-tx
|
||||
nTypeVersion = nTypeVersionIn;
|
||||
// nTypeVersion = nTypeVersionIn;
|
||||
}
|
||||
|
||||
CGovernanceObject::CGovernanceObject(const CGovernanceObject& other)
|
||||
@ -578,20 +578,20 @@ bool CGovernanceObject::IsValid(const CBlockIndex* pindex, std::string& strError
|
||||
return false;
|
||||
}
|
||||
|
||||
if(nEndTime < GetTime()) {
|
||||
strError = "Expired Proposal";
|
||||
return false;
|
||||
}
|
||||
// if(nEndTime < GetTime()) {
|
||||
// strError = "Expired Proposal";
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if(!pindex) {
|
||||
strError = "Tip is NULL";
|
||||
return true;
|
||||
}
|
||||
|
||||
if(nAmount < 10000) {
|
||||
strError = "Invalid proposal amount (minimum 10000)";
|
||||
return false;
|
||||
}
|
||||
// if(nAmount < 10000) {
|
||||
// strError = "Invalid proposal amount (minimum 10000)";
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if(strName.size() > 20) {
|
||||
strError = "Invalid proposal name, limit of 20 characters.";
|
||||
@ -603,10 +603,10 @@ bool CGovernanceObject::IsValid(const CBlockIndex* pindex, std::string& strError
|
||||
return false;
|
||||
}
|
||||
|
||||
if(address == CScript()) {
|
||||
strError = "Invalid proposal Payment Address";
|
||||
return false;
|
||||
}
|
||||
// if(address == CScript()) {
|
||||
// strError = "Invalid proposal Payment Address";
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// 12.1 - add valid predicates
|
||||
// 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.
|
||||
*/
|
||||
if(address.IsPayToScriptHash()) {
|
||||
strError = "Multisig is not currently supported.";
|
||||
return false;
|
||||
}
|
||||
// if(address.IsPayToScriptHash()) {
|
||||
// strError = "Multisig is not currently supported.";
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// 12.1 move to pybrain
|
||||
// //can only pay out 10% of the possible coins (min value of coins)
|
||||
@ -663,10 +663,10 @@ bool CGovernanceObject::NetworkWillPay()
|
||||
std::string strError = "";
|
||||
|
||||
// -- If GetAbsoluteYesCount is more than -10% of the network, flag as invalid
|
||||
if(GetAbsoluteYesCount() < -(mnodeman.CountEnabled(MIN_BUDGET_PEER_PROTO_VERSION)/10)) {
|
||||
strError = "Voted Down";
|
||||
return false;
|
||||
}
|
||||
// if(GetAbsoluteYesCount() < -(mnodeman.CountEnabled(MIN_BUDGET_PEER_PROTO_VERSION)/10)) {
|
||||
// strError = "Voted Down";
|
||||
// return false;
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -773,9 +773,9 @@ int CGovernanceManager::CountMatchingVotes(int nVoteTypeIn, int nVoteOutcomeIn)
|
||||
{
|
||||
if(!(*it3).second.IsValid(true))
|
||||
{
|
||||
if((*it3).second.nVoteType == nVoteTypeIn &&
|
||||
(*it3).second.nVoteOutcome == nVoteOutcomeIn)
|
||||
nMatching++;
|
||||
// if((*it3).second.nVoteType == nVoteTypeIn &&
|
||||
// (*it3).second.nVoteOutcome == nVoteOutcomeIn)
|
||||
// nMatching++;
|
||||
} else {
|
||||
++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);
|
||||
}
|
||||
|
||||
int nConf = 0;
|
||||
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);
|
||||
}
|
||||
// int nConf = 0;
|
||||
// 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);
|
||||
// }
|
||||
|
||||
governance.mapSeenMasternodeBudgetProposals.insert(make_pair(budgetProposalBroadcast.GetHash(), budgetProposalBroadcast));
|
||||
budgetProposalBroadcast.Relay();
|
||||
@ -288,15 +288,15 @@ UniValue mngovernance(const UniValue& params, bool fHelp)
|
||||
bObj.push_back(Pair("Name", pbudgetProposal->GetName()));
|
||||
bObj.push_back(Pair("Hash", pbudgetProposal->GetHash().ToString()));
|
||||
bObj.push_back(Pair("FeeTXHash", pbudgetProposal->nFeeTXHash.ToString()));
|
||||
bObj.push_back(Pair("StartTime", (int64_t)pbudgetProposal->GetStartTime()));
|
||||
bObj.push_back(Pair("EndTime", (int64_t)pbudgetProposal->GetEndTime()));
|
||||
// bObj.push_back(Pair("StartTime", (int64_t)pbudgetProposal->GetStartTime()));
|
||||
// bObj.push_back(Pair("EndTime", (int64_t)pbudgetProposal->GetEndTime()));
|
||||
|
||||
// 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("YesCount", (int64_t)pbudgetProposal->GetYesCount(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("IsEstablished", pbudgetProposal->IsEstablished(VOTE_ACTION_FUNDING)));
|
||||
// bObj.push_back(Pair("IsEstablished", pbudgetProposal->IsEstablished(VOTE_ACTION_FUNDING)));
|
||||
|
||||
std::string 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("Hash", pbudgetProposal->GetHash().ToString()));
|
||||
obj.push_back(Pair("FeeTXHash", pbudgetProposal->nFeeTXHash.ToString()));
|
||||
obj.push_back(Pair("StartTime", (int64_t)pbudgetProposal->GetStartTime()));
|
||||
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("YesCount", (int64_t)pbudgetProposal->GetYesCount()));
|
||||
obj.push_back(Pair("NoCount", (int64_t)pbudgetProposal->GetNoCount()));
|
||||
obj.push_back(Pair("AbstainCount", (int64_t)pbudgetProposal->GetAbstainCount()));
|
||||
// obj.push_back(Pair("StartTime", (int64_t)pbudgetProposal->GetStartTime()));
|
||||
// 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("YesCount", (int64_t)pbudgetProposal->GetYesCount()));
|
||||
// obj.push_back(Pair("NoCount", (int64_t)pbudgetProposal->GetNoCount()));
|
||||
// obj.push_back(Pair("AbstainCount", (int64_t)pbudgetProposal->GetAbstainCount()));
|
||||
obj.push_back(Pair("IsEstablished", pbudgetProposal->IsEstablished()));
|
||||
|
||||
std::string strError = "";
|
||||
|
Loading…
Reference in New Issue
Block a user