From b04faf6e2d7607979cea476fc891c8b0fd481598 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Sat, 25 Jul 2015 21:13:17 -0700 Subject: [PATCH] Update lastPing in mapSeen obj, remove ping from CMasternode hash --- src/instantx.h | 2 +- src/masternode.cpp | 7 +++++++ src/masternode.h | 1 - src/masternodeman.cpp | 11 +++++------ src/version.h | 10 +++++----- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/instantx.h b/src/instantx.h index e89328812a..03a1c94b31 100644 --- a/src/instantx.h +++ b/src/instantx.h @@ -31,7 +31,7 @@ class CConsensusVote; class CTransaction; class CTransactionLock; -static const int MIN_INSTANTX_PROTO_VERSION = 70097; +static const int MIN_INSTANTX_PROTO_VERSION = 70098; extern map mapTxLockReq; extern map mapTxLockReqRejected; diff --git a/src/masternode.cpp b/src/masternode.cpp index 42493bbea8..1cf13d546b 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -603,6 +603,13 @@ bool CMasternodePing::CheckAndUpdate(int& nDos, bool fRequireEnabled) pmn->lastPing = *this; + //mnodeman.mapSeenMasternodeBroadcast.lastPing is probably outdated, so we'll update it + CMasternodeBroadcast mnb(*pmn); + uint256 hash = mnb.GetHash(); + if(mnodeman.mapSeenMasternodeBroadcast.count(hash)) { + mnodeman.mapSeenMasternodeBroadcast[hash].lastPing = *this; + } + pmn->Check(); if(!pmn->IsEnabled()) return false; diff --git a/src/masternode.h b/src/masternode.h index e94fba39ca..4cbb8665d9 100644 --- a/src/masternode.h +++ b/src/masternode.h @@ -309,7 +309,6 @@ public: CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION); ss << sigTime; ss << pubkey; - ss << lastPing; return ss.GetHash(); } diff --git a/src/masternodeman.cpp b/src/masternodeman.cpp index d4f0098fd5..72bddb43e7 100644 --- a/src/masternodeman.cpp +++ b/src/masternodeman.cpp @@ -718,15 +718,14 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData if(mn.IsEnabled()) { if(fDebug) LogPrintf("dseg - Sending Masternode entry - %s \n", mn.addr.ToString().c_str()); - if(vin == CTxIn()){ - CInv inv(MSG_MASTERNODE_ANNOUNCE, CMasternodeBroadcast(mn).GetHash()); - vInv.push_back(inv); - } else if (vin == mn.vin) { + if(vin == CTxIn() || vin == mn.vin){ CInv inv(MSG_MASTERNODE_ANNOUNCE, CMasternodeBroadcast(mn).GetHash()); vInv.push_back(inv); - LogPrintf("dseg - Sent 1 Masternode entries to %s\n", pfrom->addr.ToString().c_str()); - return; + if(vin == mn.vin) { + LogPrintf("dseg - Sent 1 Masternode entries to %s\n", pfrom->addr.ToString().c_str()); + break; + } } i++; } diff --git a/src/version.h b/src/version.h index 788c2d62f6..224138efe7 100644 --- a/src/version.h +++ b/src/version.h @@ -10,7 +10,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 70097; +static const int PROTOCOL_VERSION = 70098; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; @@ -22,19 +22,19 @@ static const int GETHEADERS_VERSION = 70077; static const int MIN_PEER_PROTO_VERSION = 70066; //! minimum peer version accepted by DarksendPool -static const int MIN_POOL_PEER_PROTO_VERSION = 70097; +static const int MIN_POOL_PEER_PROTO_VERSION = 70098; //! minimum peer version for masternode budgets -static const int MIN_BUDGET_PEER_PROTO_VERSION = 70097; +static const int MIN_BUDGET_PEER_PROTO_VERSION = 70098; //! minimum peer version for masternode winner broadcasts -static const int MIN_MNW_PEER_PROTO_VERSION = 70097; +static const int MIN_MNW_PEER_PROTO_VERSION = 70098; //! minimum peer version that can receive masternode payments // V1 - Last protocol version before update // V2 - Newest protocol version static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1 = 70066; -static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2 = 70097; +static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2 = 70098; //! nTime field added to CAddress, starting with this version; //! if possible, avoid requesting addresses nodes older than this