mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +01:00
fixed
This commit is contained in:
parent
1182f0a176
commit
1a3ffc0ed0
@ -1274,7 +1274,7 @@ bool CMasternodePayments::GetWinningMasternode(int nBlockHeight, CTxIn& vinOut)
|
|||||||
bool CMasternodePayments::AddWinningMasternode(CMasternodePaymentWinner& winnerIn)
|
bool CMasternodePayments::AddWinningMasternode(CMasternodePaymentWinner& winnerIn)
|
||||||
{
|
{
|
||||||
uint256 blockHash = 0;
|
uint256 blockHash = 0;
|
||||||
if(!darkSendPool.GetBlockHash(blockHash, winnerIn.nBlockHeight-10)) {
|
if(!darkSendPool.GetBlockHash(blockHash, winnerIn.nBlockHeight-100)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1333,11 +1333,10 @@ int CMasternodePayments::LastPayment(CTxIn& vin)
|
|||||||
bool CMasternodePayments::ProcessBlock(int nBlockHeight)
|
bool CMasternodePayments::ProcessBlock(int nBlockHeight)
|
||||||
{
|
{
|
||||||
if(strMasterPrivKey.empty()) return false;
|
if(strMasterPrivKey.empty()) return false;
|
||||||
|
|
||||||
CMasternodePaymentWinner winner;
|
CMasternodePaymentWinner winner;
|
||||||
|
|
||||||
uint256 blockHash = 0;
|
uint256 blockHash = 0;
|
||||||
if(!darkSendPool.GetBlockHash(blockHash, nBlockHeight-10)) return false;
|
if(!darkSendPool.GetBlockHash(blockHash, nBlockHeight-100)) return false;
|
||||||
|
|
||||||
BOOST_FOREACH(CMasterNode& mn, darkSendMasterNodes) {
|
BOOST_FOREACH(CMasterNode& mn, darkSendMasterNodes) {
|
||||||
if(LastPayment(mn.vin) < darkSendMasterNodes.size()) continue;
|
if(LastPayment(mn.vin) < darkSendMasterNodes.size()) continue;
|
||||||
@ -1350,12 +1349,15 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(winner.nBlockHeight == 0) return false; //no masternodes available
|
||||||
|
|
||||||
if(Sign(winner)){
|
if(Sign(winner)){
|
||||||
if(AddWinningMasternode(winner)){
|
if(AddWinningMasternode(winner)){
|
||||||
Relay(winner);
|
Relay(winner);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1382,7 +1384,13 @@ bool CMasternodePayments::SetPrivKey(std::string strPrivKey)
|
|||||||
strMasterPrivKey = strPrivKey;
|
strMasterPrivKey = strPrivKey;
|
||||||
|
|
||||||
Sign(winner);
|
Sign(winner);
|
||||||
return CheckSignature(winner);
|
|
||||||
|
if(CheckSignature(winner)){
|
||||||
|
LogPrintf("Successfully initialized as masternode payments master\n");
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4201,7 +4201,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
|
|
||||||
if(pindexBest == NULL) return false;
|
if(pindexBest == NULL) return false;
|
||||||
|
|
||||||
if(winner.nBlockHeight > pindexBest->nHeight - 10 || winner.nBlockHeight < pindexBest->nHeight+20){
|
if(winner.nBlockHeight < pindexBest->nHeight - 10 || winner.nBlockHeight > pindexBest->nHeight+20){
|
||||||
LogPrintf("mnw - winner out of range %s Height %d bestHeight %d\n", winner.vin.ToString().c_str(), winner.nBlockHeight, pindexBest->nHeight);
|
LogPrintf("mnw - winner out of range %s Height %d bestHeight %d\n", winner.vin.ToString().c_str(), winner.nBlockHeight, pindexBest->nHeight);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -5401,7 +5401,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
//spork
|
//spork
|
||||||
if(!masternodePayments.GetBlockPayee(pindexPrev->nHeight+1, pblock->payee)){
|
if(!masternodePayments.GetBlockPayee(pindexPrev->nHeight+1, pblock->payee)){
|
||||||
//no masternode detected
|
//no masternode detected
|
||||||
winningNode = darkSendPool.GetCurrentMasterNode(1);
|
int winningNode = darkSendPool.GetCurrentMasterNode(1);
|
||||||
if(winningNode >= 0){
|
if(winningNode >= 0){
|
||||||
pblock->payee.SetDestination(darkSendMasterNodes[winningNode].pubkey.GetID());
|
pblock->payee.SetDestination(darkSendMasterNodes[winningNode].pubkey.GetID());
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user