- removed hybrid mode (masternode winners reference node). This feature was added to 12.0 incase we had network troubles and required a "safe-mode" to run in. We've experiences no issues like so it should be safe to remove
- fixed masternode winners calculation and listing
This commit is contained in:
parent
26b297f7fd
commit
7240f96e29
@ -45,7 +45,7 @@ CActiveMasternode activeMasternode;
|
|||||||
udjinm6 - udjinm6@dash.org
|
udjinm6 - udjinm6@dash.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
|
void CDarksendPool::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
|
||||||
{
|
{
|
||||||
if(fLiteMode) return; //disable all Darksend/Masternode related functionality
|
if(fLiteMode) return; //disable all Darksend/Masternode related functionality
|
||||||
if(!masternodeSync.IsBlockchainSynced()) return;
|
if(!masternodeSync.IsBlockchainSynced()) return;
|
||||||
|
@ -360,7 +360,7 @@ public:
|
|||||||
* dssub | Darksend Subscribe To
|
* dssub | Darksend Subscribe To
|
||||||
* \param vRecv
|
* \param vRecv
|
||||||
*/
|
*/
|
||||||
void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
|
void ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
|
||||||
|
|
||||||
void InitCollateralAddress(){
|
void InitCollateralAddress(){
|
||||||
SetCollateralAddress(Params().DarksendPoolDummyAddress());
|
SetCollateralAddress(Params().DarksendPoolDummyAddress());
|
||||||
|
@ -5604,9 +5604,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
//probably one the extensions
|
//probably one the extensions
|
||||||
darkSendPool.ProcessMessageDarksend(pfrom, strCommand, vRecv);
|
darkSendPool.ProcessMessage(pfrom, strCommand, vRecv);
|
||||||
mnodeman.ProcessMessage(pfrom, strCommand, vRecv);
|
mnodeman.ProcessMessage(pfrom, strCommand, vRecv);
|
||||||
mnpayments.ProcessMessageMasternodePayments(pfrom, strCommand, vRecv);
|
mnpayments.ProcessMessage(pfrom, strCommand, vRecv);
|
||||||
ProcessMessageInstantX(pfrom, strCommand, vRecv);
|
ProcessMessageInstantX(pfrom, strCommand, vRecv);
|
||||||
ProcessSpork(pfrom, strCommand, vRecv);
|
ProcessSpork(pfrom, strCommand, vRecv);
|
||||||
masternodeSync.ProcessMessage(pfrom, strCommand, vRecv);
|
masternodeSync.ProcessMessage(pfrom, strCommand, vRecv);
|
||||||
|
@ -288,12 +288,15 @@ void FillBlockPayee(CMutableTransaction& txNew, CAmount nFees)
|
|||||||
|
|
||||||
std::string GetRequiredPaymentsString(int nBlockHeight)
|
std::string GetRequiredPaymentsString(int nBlockHeight)
|
||||||
{
|
{
|
||||||
// 12.1
|
// 12.1 -- added triggered payments
|
||||||
|
|
||||||
// if(IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && budget.IsBudgetPaymentBlock(nBlockHeight)){
|
// if(IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && budget.IsBudgetPaymentBlock(nBlockHeight)){
|
||||||
// return budget.GetRequiredPaymentsString(nBlockHeight);
|
// return budget.GetRequiredPaymentsString(nBlockHeight);
|
||||||
// } else {
|
// } else {
|
||||||
// return mnpayments.GetRequiredPaymentsString(nBlockHeight);
|
// return mnpayments.GetRequiredPaymentsString(nBlockHeight);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
return mnpayments.GetRequiredPaymentsString(nBlockHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, CAmount nFees)
|
void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, CAmount nFees)
|
||||||
@ -343,7 +346,7 @@ int CMasternodePayments::GetMinMasternodePaymentsProto() {
|
|||||||
: MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1;
|
: MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMasternodePayments::ProcessMessageMasternodePayments(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
|
void CMasternodePayments::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
|
||||||
{
|
{
|
||||||
if(!masternodeSync.IsBlockchainSynced()) return;
|
if(!masternodeSync.IsBlockchainSynced()) return;
|
||||||
|
|
||||||
@ -500,9 +503,7 @@ bool CMasternodePayments::AddWinningMasternode(CMasternodePaymentWinner& winnerI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int n = 1;
|
mapMasternodeBlocks[winnerIn.nBlockHeight].AddPayee(winnerIn.payee, 1);
|
||||||
if(IsReferenceNode(winnerIn.vinMasternode)) n = 100;
|
|
||||||
mapMasternodeBlocks[winnerIn.nBlockHeight].AddPayee(winnerIn.payee, n);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -622,20 +623,8 @@ void CMasternodePayments::CheckAndRemove()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsReferenceNode(CTxIn& vin)
|
|
||||||
{
|
|
||||||
//reference node - hybrid mode
|
|
||||||
if(vin.prevout.ToStringShort() == "099c01bea63abd1692f60806bb646fa1d288e2d049281225f17e499024084e28-0") return true; // mainnet
|
|
||||||
if(vin.prevout.ToStringShort() == "fbc16ae5229d6d99181802fd76a4feee5e7640164dcebc7f8feb04a7bea026f8-0") return true; // testnet
|
|
||||||
if(vin.prevout.ToStringShort() == "e466f5d8beb4c2d22a314310dc58e0ea89505c95409754d0d68fb874952608cc-1") return true; // regtest
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CMasternodePaymentWinner::IsValid(CNode* pnode, std::string& strError)
|
bool CMasternodePaymentWinner::IsValid(CNode* pnode, std::string& strError)
|
||||||
{
|
{
|
||||||
if(IsReferenceNode(vinMasternode)) return true;
|
|
||||||
|
|
||||||
CMasternode* pmn = mnodeman.Find(vinMasternode);
|
CMasternode* pmn = mnodeman.Find(vinMasternode);
|
||||||
|
|
||||||
if(!pmn)
|
if(!pmn)
|
||||||
@ -675,57 +664,35 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight)
|
|||||||
{
|
{
|
||||||
if(!fMasterNode) return false;
|
if(!fMasterNode) return false;
|
||||||
|
|
||||||
//reference node - hybrid mode
|
|
||||||
|
|
||||||
if(!IsReferenceNode(activeMasternode.vin)){
|
|
||||||
int n = mnodeman.GetMasternodeRank(activeMasternode.vin, nBlockHeight-100, MIN_MNW_PEER_PROTO_VERSION);
|
|
||||||
|
|
||||||
if(n == -1)
|
|
||||||
{
|
|
||||||
LogPrint("mnpayments", "CMasternodePayments::ProcessBlock - Unknown Masternode\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(n > MNPAYMENTS_SIGNATURES_TOTAL)
|
|
||||||
{
|
|
||||||
LogPrint("mnpayments", "CMasternodePayments::ProcessBlock - Masternode not in the top %d (%d)\n", MNPAYMENTS_SIGNATURES_TOTAL, n);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(nBlockHeight <= nLastBlockHeight) return false;
|
|
||||||
|
|
||||||
CMasternodePaymentWinner newWinner(activeMasternode.vin);
|
CMasternodePaymentWinner newWinner(activeMasternode.vin);
|
||||||
|
|
||||||
// 12.1
|
// LOCATE THE NEXT MASTERNODE WHICH SHOULD BE PAID
|
||||||
// if(budget.IsBudgetPaymentBlock(nBlockHeight)){
|
|
||||||
// //is budget payment block -- handled by the budgeting software
|
|
||||||
// } else {
|
|
||||||
// LogPrintf("CMasternodePayments::ProcessBlock() Start nHeight %d - vin %s. \n", nBlockHeight, activeMasternode.vin.ToString());
|
|
||||||
|
|
||||||
// // pay to the oldest MN that still had no payment but its input is old enough and it was active long enough
|
{
|
||||||
// int nCount = 0;
|
LogPrintf("CMasternodePayments::ProcessBlock() Start nHeight %d - vin %s. \n", nBlockHeight, activeMasternode.vin.ToString());
|
||||||
// CMasternode *pmn = mnodeman.GetNextMasternodeInQueueForPayment(nBlockHeight, true, nCount);
|
|
||||||
|
// pay to the oldest MN that still had no payment but its input is old enough and it was active long enough
|
||||||
|
int nCount = 0;
|
||||||
|
CMasternode *pmn = mnodeman.GetNextMasternodeInQueueForPayment(nBlockHeight, true, nCount);
|
||||||
|
|
||||||
// if(pmn != NULL)
|
if(pmn != NULL)
|
||||||
// {
|
{
|
||||||
// LogPrintf("CMasternodePayments::ProcessBlock() Found by FindOldestNotInVec \n");
|
LogPrintf("CMasternodePayments::ProcessBlock() Found by FindOldestNotInVec \n");
|
||||||
|
|
||||||
// newWinner.nBlockHeight = nBlockHeight;
|
newWinner.nBlockHeight = nBlockHeight;
|
||||||
|
|
||||||
// CScript payee = GetScriptForDestination(pmn->pubkey.GetID());
|
CScript payee = GetScriptForDestination(pmn->pubkey.GetID());
|
||||||
// newWinner.AddPayee(payee);
|
newWinner.AddPayee(payee);
|
||||||
|
|
||||||
// CTxDestination address1;
|
CTxDestination address1;
|
||||||
// ExtractDestination(payee, address1);
|
ExtractDestination(payee, address1);
|
||||||
// CBitcoinAddress address2(address1);
|
CBitcoinAddress address2(address1);
|
||||||
|
|
||||||
// LogPrintf("CMasternodePayments::ProcessBlock() Winner payee %s nHeight %d. \n", address2.ToString(), newWinner.nBlockHeight);
|
LogPrintf("CMasternodePayments::ProcessBlock() Winner payee %s nHeight %d. \n", address2.ToString(), newWinner.nBlockHeight);
|
||||||
// } else {
|
} else {
|
||||||
// LogPrintf("CMasternodePayments::ProcessBlock() Failed to find masternode to pay\n");
|
LogPrintf("CMasternodePayments::ProcessBlock() Failed to find masternode to pay\n");
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
std::string errorMessage;
|
std::string errorMessage;
|
||||||
CPubKey pubKeyMasternode;
|
CPubKey pubKeyMasternode;
|
||||||
@ -745,7 +712,6 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight)
|
|||||||
if(AddWinningMasternode(newWinner))
|
if(AddWinningMasternode(newWinner))
|
||||||
{
|
{
|
||||||
newWinner.Relay();
|
newWinner.Relay();
|
||||||
nLastBlockHeight = nBlockHeight;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ extern CMasternodePayments mnpayments;
|
|||||||
#define MNPAYMENTS_SIGNATURES_REQUIRED 6
|
#define MNPAYMENTS_SIGNATURES_REQUIRED 6
|
||||||
#define MNPAYMENTS_SIGNATURES_TOTAL 10
|
#define MNPAYMENTS_SIGNATURES_TOTAL 10
|
||||||
|
|
||||||
void ProcessMessageMasternodePayments(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
|
void ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
|
||||||
bool IsReferenceNode(CTxIn& vin);
|
bool IsReferenceNode(CTxIn& vin);
|
||||||
bool IsBlockPayeeValid(const CTransaction& txNew, int nBlockHeight);
|
bool IsBlockPayeeValid(const CTransaction& txNew, int nBlockHeight);
|
||||||
std::string GetRequiredPaymentsString(int nBlockHeight);
|
std::string GetRequiredPaymentsString(int nBlockHeight);
|
||||||
@ -225,7 +225,6 @@ class CMasternodePayments
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int nSyncedFromPeer;
|
int nSyncedFromPeer;
|
||||||
int nLastBlockHeight;
|
|
||||||
// Keep track of current block index
|
// Keep track of current block index
|
||||||
const CBlockIndex *pCurrentBlockIndex;
|
const CBlockIndex *pCurrentBlockIndex;
|
||||||
|
|
||||||
@ -236,7 +235,6 @@ public:
|
|||||||
|
|
||||||
CMasternodePayments() {
|
CMasternodePayments() {
|
||||||
nSyncedFromPeer = 0;
|
nSyncedFromPeer = 0;
|
||||||
nLastBlockHeight = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clear() {
|
void Clear() {
|
||||||
@ -271,7 +269,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int GetMinMasternodePaymentsProto();
|
int GetMinMasternodePaymentsProto();
|
||||||
void ProcessMessageMasternodePayments(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
|
void ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
|
||||||
std::string GetRequiredPaymentsString(int nBlockHeight);
|
std::string GetRequiredPaymentsString(int nBlockHeight);
|
||||||
void FillBlockPayee(CMutableTransaction& txNew, CAmount nFees);
|
void FillBlockPayee(CMutableTransaction& txNew, CAmount nFees);
|
||||||
std::string ToString() const;
|
std::string ToString() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user