local nLastDsq (#1211)

* Revert behaviour introduced in 5e1a6afe7f, make nLastDsq local variable instead of being network-wide one. Should fix mixing for new clients and for those who was offline for too long.

* fix docs
This commit is contained in:
UdjinM6 2016-12-20 03:09:38 +04:00 committed by GitHub
parent ff12698ed5
commit fa301ecb49
5 changed files with 13 additions and 4 deletions

View File

@ -67,7 +67,7 @@ Whenever a masternode comes online or a client is syncing, they will send this m
| 8 | sigTime | int64_t | Time which the signature was created | 8 | sigTime | int64_t | Time which the signature was created
| 4 | nProtocolVersion | int | The protocol version of the masternode | 4 | nProtocolVersion | int | The protocol version of the masternode
| # | lastPing | CMasternodePing | The last known ping of the masternode | # | lastPing | CMasternodePing | The last known ping of the masternode
| 8 | nLastDsq | int64_t | The last time the masternode sent a DSQ message (for mixing) | 8 | nLastDsq | int64_t | The last time the masternode sent a DSQ message (for mixing) (DEPRECATED)
### MNPING - "mnp" ### MNPING - "mnp"

View File

@ -5145,6 +5145,10 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss.reserve(1000); ss.reserve(1000);
ss << mnodeman.mapSeenMasternodeBroadcast[inv.hash]; ss << mnodeman.mapSeenMasternodeBroadcast[inv.hash];
// backward compatibility patch
if(pfrom->nVersion < 70204) {
ss << (int64_t)0;
}
pfrom->PushMessage(NetMsgType::MNANNOUNCE, ss); pfrom->PushMessage(NetMsgType::MNANNOUNCE, ss);
pushed = true; pushed = true;
} }

View File

@ -90,7 +90,7 @@ CMasternode::CMasternode(const CMasternodeBroadcast& mnb) :
lastPing(mnb.lastPing), lastPing(mnb.lastPing),
vchSig(mnb.vchSig), vchSig(mnb.vchSig),
sigTime(mnb.sigTime), sigTime(mnb.sigTime),
nLastDsq(mnb.nLastDsq), nLastDsq(0),
nTimeLastChecked(0), nTimeLastChecked(0),
nTimeLastPaid(0), nTimeLastPaid(0),
nTimeLastWatchdogVote(mnb.sigTime), nTimeLastWatchdogVote(mnb.sigTime),

View File

@ -342,7 +342,6 @@ public:
READWRITE(sigTime); READWRITE(sigTime);
READWRITE(nProtocolVersion); READWRITE(nProtocolVersion);
READWRITE(lastPing); READWRITE(lastPing);
READWRITE(nLastDsq);
} }
uint256 GetHash() const uint256 GetHash() const

View File

@ -19,7 +19,7 @@
/** Masternode manager */ /** Masternode manager */
CMasternodeMan mnodeman; CMasternodeMan mnodeman;
const std::string CMasternodeMan::SERIALIZATION_VERSION_STRING = "CMasternodeMan-Version-1"; const std::string CMasternodeMan::SERIALIZATION_VERSION_STRING = "CMasternodeMan-Version-2";
struct CompareLastPaidBlock struct CompareLastPaidBlock
{ {
@ -700,6 +700,12 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
CMasternodeBroadcast mnb; CMasternodeBroadcast mnb;
vRecv >> mnb; vRecv >> mnb;
// backward compatibility patch
if(pfrom->nVersion < 70204) {
int64_t nLastDsqDummy;
vRecv >> nLastDsqDummy;
}
int nDos = 0; int nDos = 0;
if (CheckMnbAndUpdateMasternodeList(mnb, nDos)) { if (CheckMnbAndUpdateMasternodeList(mnb, nDos)) {