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