check collateral tx, find masternode before vote

This commit is contained in:
Evan Duffield 2015-08-04 09:31:05 -07:00
parent 43fd168aa1
commit a0addf20a9

View File

@ -106,7 +106,9 @@ Value mnbudget(const Array& params, bool fHelp)
// }
CWalletTx wtx;
pwalletMain->GetBudgetSystemCollateralTX(wtx, budgetProposalBroadcast.GetHash(), useIX);
if(!pwalletMain->GetBudgetSystemCollateralTX(wtx, budgetProposalBroadcast.GetHash(), useIX)){
return "Error making collateral transaction for proposal. Please check your wallet balance and make sure your wallet is unlocked.";
}
// make our change address
CReserveKey reservekey(pwalletMain);
@ -297,6 +299,12 @@ Value mnbudget(const Array& params, bool fHelp)
if(!darkSendSigner.SetKey(strMasterNodePrivKey, errorMessage, keyMasternode, pubKeyMasternode))
return "Error upon calling SetKey";
CMasternode* pmn = mnodeman.Find(activeMasternode.vin);
if(pmn == NULL)
{
return "Failure to find masternode in list : " + activeMasternode.vin.ToString();
}
CBudgetVote vote(activeMasternode.vin, hash, nVote);
if(!vote.Sign(keyMasternode, pubKeyMasternode)){
return "Failure to sign.";
@ -596,6 +604,12 @@ Value mnfinalbudget(const Array& params, bool fHelp)
if(!darkSendSigner.SetKey(strMasterNodePrivKey, errorMessage, keyMasternode, pubKeyMasternode))
return "Error upon calling SetKey";
CMasternode* pmn = mnodeman.Find(activeMasternode.vin);
if(pmn == NULL)
{
return "Failure to find masternode in list : " + activeMasternode.vin.ToString();
}
CFinalizedBudgetVote vote(activeMasternode.vin, hash);
if(!vote.Sign(keyMasternode, pubKeyMasternode)){
return "Failure to sign.";