Skip to content

Commit

Permalink
Governance bug fix (#998)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tgflynn authored and UdjinM6 committed Sep 9, 2016
1 parent 740d1e0 commit d81e729
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/governance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
11 changes: 8 additions & 3 deletions src/rpcgovernance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down

0 comments on commit d81e729

Please sign in to comment.