mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +01:00
Dont accept MNW from older masternodes
This commit is contained in:
parent
de485fe93d
commit
3fae250190
@ -324,9 +324,7 @@ void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, int64_t nFe
|
|||||||
}
|
}
|
||||||
|
|
||||||
int CMasternodePayments::GetMinMasternodePaymentsProto() {
|
int CMasternodePayments::GetMinMasternodePaymentsProto() {
|
||||||
return IsSporkActive(SPORK_10_MASTERNODE_PAY_NEWEST_NODES)
|
return MIN_MNW_PEER_PROTO_VERSION;
|
||||||
? MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2
|
|
||||||
: MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMasternodePayments::ProcessMessageMasternodePayments(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
|
void CMasternodePayments::ProcessMessageMasternodePayments(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
|
||||||
@ -593,17 +591,28 @@ bool CMasternodePaymentWinner::IsValid(std::string& strError)
|
|||||||
{
|
{
|
||||||
if(IsReferenceNode(vinMasternode)) return true;
|
if(IsReferenceNode(vinMasternode)) return true;
|
||||||
|
|
||||||
int n = mnodeman.GetMasternodeRank(vinMasternode, nBlockHeight-100, masternodePayments.GetMinMasternodePaymentsProto());
|
CMasternode* pmn = mnodeman.Find(vinMasternode);
|
||||||
|
|
||||||
if(n == -1)
|
if(!pmn)
|
||||||
{
|
{
|
||||||
LogPrintf("CMasternodePaymentWinner::IsValid - Unknown Masternode - %s\n", vinMasternode.ToString().c_str());
|
strError = strprintf("Unknown Masternode %s", vinMasternode.prevout.ToStringShort());
|
||||||
|
LogPrintf ("CMasternodePaymentWinner::IsValid - %s\n", strError);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(pmn->protocolVersion < GetMinMasternodePaymentsProto())
|
||||||
|
{
|
||||||
|
strError = strprintf("Masternode protocol too old %d - req %d", pmn->protocolVersion, GetMinMasternodePaymentsProto());
|
||||||
|
LogPrintf ("CMasternodePaymentWinner::IsValid - %s\n", strError);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int n = mnodeman.GetMasternodeRank(vinMasternode, nBlockHeight-100, masternodePayments.GetMinMasternodePaymentsProto());
|
||||||
|
|
||||||
if(n > MNPAYMENTS_SIGNATURES_TOTAL)
|
if(n > MNPAYMENTS_SIGNATURES_TOTAL)
|
||||||
{
|
{
|
||||||
LogPrintf("CMasternodePaymentWinner::IsValid - Masternode not in the top %d (%d)\n", MNPAYMENTS_SIGNATURES_TOTAL, n);
|
strError = strprintf("Masternode not in the top %d (%d)", MNPAYMENTS_SIGNATURES_TOTAL, n);
|
||||||
|
LogPrintf ("CMasternodePaymentWinner::IsValid - %s\n", strError);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,9 @@ static const int MIN_POOL_PEER_PROTO_VERSION = 70093;
|
|||||||
//! minimum peer version for masternode budgets
|
//! minimum peer version for masternode budgets
|
||||||
static const int MIN_BUDGET_PEER_PROTO_VERSION = 70093;
|
static const int MIN_BUDGET_PEER_PROTO_VERSION = 70093;
|
||||||
|
|
||||||
|
//! minimum peer version for masternode winner broadcasts
|
||||||
|
static const int MIN_MNW_PEER_PROTO_VERSION = 70093;
|
||||||
|
|
||||||
//! minimum peer version that can receive masternode payments
|
//! minimum peer version that can receive masternode payments
|
||||||
// V1 - Last protocol version before update
|
// V1 - Last protocol version before update
|
||||||
// V2 - Newest protocol version
|
// V2 - Newest protocol version
|
||||||
|
Loading…
Reference in New Issue
Block a user