fixed vote-many
This commit is contained in:
parent
d120557b05
commit
631e4b505f
@ -3,7 +3,7 @@ AC_PREREQ([2.60])
|
||||
define(_CLIENT_VERSION_MAJOR, 0)
|
||||
define(_CLIENT_VERSION_MINOR, 11)
|
||||
define(_CLIENT_VERSION_REVISION, 2)
|
||||
define(_CLIENT_VERSION_BUILD, 18)
|
||||
define(_CLIENT_VERSION_BUILD, 19)
|
||||
define(_CLIENT_VERSION_IS_RELEASE, true)
|
||||
define(_COPYRIGHT_YEAR, 2015)
|
||||
AC_INIT([Dash Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@dashpay.io],[dash])
|
||||
|
@ -12,7 +12,7 @@
|
||||
#define CLIENT_VERSION_MAJOR 0
|
||||
#define CLIENT_VERSION_MINOR 11
|
||||
#define CLIENT_VERSION_REVISION 2
|
||||
#define CLIENT_VERSION_BUILD 18
|
||||
#define CLIENT_VERSION_BUILD 19
|
||||
|
||||
|
||||
|
||||
|
@ -333,6 +333,20 @@ CMasternode *CMasternodeMan::Find(const CTxIn &vin)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
CMasternode *CMasternodeMan::Find(const CPubKey &pubKeyMasternode)
|
||||
{
|
||||
LOCK(cs);
|
||||
|
||||
BOOST_FOREACH(CMasternode& mn, vMasternodes)
|
||||
{
|
||||
if(mn.pubkey2 == pubKeyMasternode)
|
||||
return &mn;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
CMasternode* CMasternodeMan::FindOldestNotInVec(const std::vector<CTxIn> &vVins, int nMinimumAge, int nMinimumActiveSeconds)
|
||||
{
|
||||
LOCK(cs);
|
||||
|
@ -108,6 +108,7 @@ public:
|
||||
|
||||
/// Find an entry
|
||||
CMasternode* Find(const CTxIn& vin);
|
||||
CMasternode* Find(const CPubKey& pubKeyMasternode);
|
||||
|
||||
/// Find an entry thta do not match every entry provided vector
|
||||
CMasternode* FindOldestNotInVec(const std::vector<CTxIn> &vVins, int nMinimumAge, int nMinimumActiveSeconds);
|
||||
|
@ -583,6 +583,9 @@ Value masternode(const Array& params, bool fHelp)
|
||||
if(vote == "nay") nVote = -1;
|
||||
|
||||
|
||||
int success = 0;
|
||||
int failed = 0;
|
||||
|
||||
Object resultObj;
|
||||
|
||||
BOOST_FOREACH(CMasternodeConfig::CMasternodeEntry mne, masternodeConfig.getEntries()) {
|
||||
@ -596,27 +599,43 @@ Value masternode(const Array& params, bool fHelp)
|
||||
CPubKey pubKeyMasternode;
|
||||
CKey keyMasternode;
|
||||
|
||||
if(!activeMasternode.GetMasterNodeVin(vin, pubKeyCollateralAddress, keyCollateralAddress, mne.getTxHash(), mne.getOutputIndex())) {
|
||||
return("could not allocate vin");
|
||||
if(!darkSendSigner.SetKey(mne.getPrivKey(), errorMessage, keyMasternode, pubKeyMasternode)){
|
||||
printf(" Error upon calling SetKey for %s\n", mne.getAlias().c_str());
|
||||
failed++;
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string strMessage = vin.ToString() + boost::lexical_cast<std::string>(nVote);
|
||||
CMasternode* pmn = mnodeman.Find(pubKeyMasternode);
|
||||
if(pmn == NULL)
|
||||
{
|
||||
printf("Can't find masternode by pubkey for %s\n", mne.getAlias().c_str());
|
||||
failed++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!darkSendSigner.SetKey(mne.getPrivKey(), errorMessage, keyMasternode, pubKeyMasternode))
|
||||
return(" Error upon calling SetKey");
|
||||
std::string strMessage = pmn->vin.ToString() + boost::lexical_cast<std::string>(nVote);
|
||||
|
||||
if(!darkSendSigner.SignMessage(strMessage, errorMessage, vchMasterNodeSignature, keyMasternode))
|
||||
return(" Error upon calling SignMessage");
|
||||
if(!darkSendSigner.SignMessage(strMessage, errorMessage, vchMasterNodeSignature, keyMasternode)){
|
||||
printf(" Error upon calling SignMessage for %s\n", mne.getAlias().c_str());
|
||||
failed++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!darkSendSigner.VerifyMessage(pubKeyMasternode, vchMasterNodeSignature, strMessage, errorMessage))
|
||||
return(" Error upon calling VerifyMessage");
|
||||
if(!darkSendSigner.VerifyMessage(pubKeyMasternode, vchMasterNodeSignature, strMessage, errorMessage)){
|
||||
printf(" Error upon calling VerifyMessage for %s\n", mne.getAlias().c_str());
|
||||
failed++;
|
||||
continue;
|
||||
}
|
||||
|
||||
success++;
|
||||
|
||||
//send to all peers
|
||||
LOCK(cs_vNodes);
|
||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||
pnode->PushMessage("mvote", vin, vchMasterNodeSignature, nVote);
|
||||
|
||||
}
|
||||
|
||||
return("Voted successfully " + boost::lexical_cast<std::string>(success) + " time(s) and failed " + boost::lexical_cast<std::string>(failed) + " time(s).");
|
||||
}
|
||||
|
||||
if(strCommand == "vote")
|
||||
|
Loading…
Reference in New Issue
Block a user