Governance bug fix (#998)

* Added more specific error message about attempts to submit superblocks by
non-masternodes

* Fixed governance object validation bug

* Fixed logic bug in governance object submission
This commit is contained in:
Tim Flynn 2016-09-09 11:52:10 -04:00 committed by UdjinM6
parent 740d1e0b1e
commit d81e729b0a
2 changed files with 9 additions and 4 deletions

View File

@ -956,7 +956,7 @@ bool CGovernanceObject::IsValidLocally(const CBlockIndex* pindex, std::string& s
if(fCheckCollateral) {
if(nObjectType == GOVERNANCE_OBJECT_TRIGGER) {
CMasternode mn;
if(mnodeman.Get(pubkeyMasternode, mn)) {
if(!mnodeman.Get(pubkeyMasternode, mn)) {
strError = "Masternode not found";
return false;
}

View File

@ -186,9 +186,14 @@ UniValue gobject(const UniValue& params, bool fHelp)
<< endl; );
// Attempt to sign triggers if we are a MN
if((govobj.GetObjectType() == GOVERNANCE_OBJECT_TRIGGER) && mnFound) {
govobj.SetMasternodeInfo(mn.vin, activeMasternode.pubKeyMasternode);
govobj.Sign(activeMasternode.keyMasternode);
if(govobj.GetObjectType() == GOVERNANCE_OBJECT_TRIGGER) {
if(mnFound) {
govobj.SetMasternodeInfo(mn.vin, activeMasternode.pubKeyMasternode);
govobj.Sign(activeMasternode.keyMasternode);
}
else {
throw JSONRPCError(RPC_INTERNAL_ERROR, "Only valid masternodes can submit this type of object");
}
}
std::string strError = "";