Merge #911: Fix sync process: (#911)

- mn hash compatibility with 70103
- ignore some requests while syncing
- fix locking/initializing in sync
- do not ban for old mnw
- split budget/governance messages/invs
This commit is contained in:
UdjinM6 2016-08-05 20:25:03 +04:00 committed by Holger Schinzel
parent d2c6b2a74e
commit b4cb1e2610
10 changed files with 199 additions and 157 deletions

View File

@ -43,7 +43,7 @@ CGovernanceVote::CGovernanceVote(CTxIn vinMasternodeIn, uint256 nParentHashIn, i
void CGovernanceVote::Relay()
{
CInv inv(MSG_GOVERNANCE_VOTE, GetHash());
CInv inv(MSG_GOVERNANCE_OBJECT_VOTE, GetHash());
RelayInv(inv, MSG_GOVERNANCE_PEER_PROTO_VERSION);
}

View File

@ -103,12 +103,23 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, std::string& strCommand, C
if(fLiteMode) return;
if(!masternodeSync.IsBlockchainSynced()) return;
//
// REMOVE AFTER MIGRATION TO 12.1
//
if(pfrom->nVersion < 70201) return;
//
// END REMOVE
//
LOCK(cs_budget);
// GOVERANCE SYNCING FUNCTIONALITY
if (strCommand == NetMsgType::MNGOVERNANCESYNC)
{
// ignore such request until we are fully synced
if (!masternodeSync.IsSynced()) return;
uint256 nProp;
vRecv >> nProp;
@ -169,15 +180,14 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, std::string& strCommand, C
mapSeenGovernanceObjects.insert(make_pair(govobj.GetHash(), SEEN_OBJECT_IS_VALID));
masternodeSync.AddedBudgetItem(govobj.GetHash());
LogPrintf("Governance object - new! - %s\n", govobj.GetHash().ToString());
LogPrintf("MNGOVERNANCEOBJECT -- %s new\n", govobj.GetHash().ToString());
//We might have active votes for this proposal that are valid now
CheckOrphanVotes();
}
// NEW GOVERNANCE OBJECT VOTE
else if (strCommand == NetMsgType::MNGOVERNANCEVOTE)
else if (strCommand == NetMsgType::MNGOVERNANCEOBJECTVOTE)
{
CGovernanceVote vote;
@ -466,7 +476,7 @@ void CGovernanceManager::Sync(CNode* pfrom, uint256 nProp)
std::map<uint256, CGovernanceVote>::iterator it2 = mapVotesByHash.begin();
while(it2 != mapVotesByHash.end()) {
pfrom->PushInventory(CInv(MSG_GOVERNANCE_VOTE, (*it2).first));
pfrom->PushInventory(CInv(MSG_GOVERNANCE_OBJECT_VOTE, (*it2).first));
nInvCount++;
++it2;
}

View File

@ -4686,12 +4686,6 @@ bool static AlreadyHave(const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
case MSG_MASTERNODE_WINNER:
return mnpayments.mapMasternodePayeeVotes.count(inv.hash);
case MSG_GOVERNANCE_VOTE:
return governance.mapVotesByHash.count(inv.hash);
case MSG_GOVERNANCE_OBJECT:
return governance.mapObjects.count(inv.hash);
case MSG_MASTERNODE_ANNOUNCE:
return mnodeman.mapSeenMasternodeBroadcast.count(inv.hash);
@ -4700,7 +4694,14 @@ bool static AlreadyHave(const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
case MSG_DSTX:
return mapDarksendBroadcastTxes.count(inv.hash);
case MSG_GOVERNANCE_OBJECT:
return governance.mapObjects.count(inv.hash);
case MSG_GOVERNANCE_OBJECT_VOTE:
return governance.mapVotesByHash.count(inv.hash);
}
// Don't know what it is, just say we already got one
return true;
}
@ -4861,26 +4862,6 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
pushed = true;
}
}
if (!pushed && inv.type == MSG_GOVERNANCE_VOTE) {
if(governance.mapVotesByHash.count(inv.hash)) {
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss.reserve(1000);
ss << governance.mapVotesByHash[inv.hash];
pfrom->PushMessage(NetMsgType::MNGOVERNANCEVOTE, ss);
pushed = true;
}
}
if (!pushed && inv.type == MSG_GOVERNANCE_OBJECT) {
if(governance.mapObjects.count(inv.hash)) {
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss.reserve(1000);
ss << governance.mapObjects[inv.hash];
pfrom->PushMessage(NetMsgType::MNGOVERNANCEOBJECT, ss);
pushed = true;
}
}
if (!pushed && inv.type == MSG_MASTERNODE_ANNOUNCE) {
if(mnodeman.mapSeenMasternodeBroadcast.count(inv.hash)){
@ -4917,6 +4898,25 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
}
}
if (!pushed && inv.type == MSG_GOVERNANCE_OBJECT) {
if(governance.mapObjects.count(inv.hash)) {
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss.reserve(1000);
ss << governance.mapObjects[inv.hash];
pfrom->PushMessage(NetMsgType::MNGOVERNANCEOBJECT, ss);
pushed = true;
}
}
if (!pushed && inv.type == MSG_GOVERNANCE_OBJECT_VOTE) {
if(governance.mapVotesByHash.count(inv.hash)) {
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss.reserve(1000);
ss << governance.mapVotesByHash[inv.hash];
pfrom->PushMessage(NetMsgType::MNGOVERNANCEOBJECTVOTE, ss);
pushed = true;
}
}
if (!pushed)
vNotFound.push_back(inv);

View File

@ -194,7 +194,9 @@ void CMasternodePayments::ProcessMessage(CNode* pfrom, std::string& strCommand,
if (strCommand == NetMsgType::MNWINNERSSYNC) { //Masternode Payments Request Sync
if(fLiteMode) return; //disable all Darksend/Masternode related functionality
// ignore such request until we are fully synced
if (!masternodeSync.IsSynced()) return;
int nCountNeeded;
vRecv >> nCountNeeded;
@ -220,32 +222,38 @@ void CMasternodePayments::ProcessMessage(CNode* pfrom, std::string& strCommand,
if(!pCurrentBlockIndex) return;
if(mapMasternodePayeeVotes.count(winner.GetHash())){
LogPrint("mnpayments", "mnw - Already seen - %s bestHeight %d\n", winner.GetHash().ToString(), pCurrentBlockIndex->nHeight);
// can't really verify it until masternode list is synced, reject it for now
if (masternodeSync.RequestedMasternodeAssets < MASTERNODE_SYNC_MNW) return;
if(mapMasternodePayeeVotes.count(winner.GetHash())) {
LogPrint("mnpayments", "MNWINNER -- Already seen: hash=%s, nHeight=%d\n", winner.GetHash().ToString(), pCurrentBlockIndex->nHeight);
masternodeSync.AddedMasternodeWinner(winner.GetHash());
return;
}
int nFirstBlock = pCurrentBlockIndex->nHeight - (mnodeman.CountEnabled()*1.25);
if(winner.nBlockHeight < nFirstBlock || winner.nBlockHeight > pCurrentBlockIndex->nHeight+20){
LogPrint("mnpayments", "mnw - winner out of range - FirstBlock %d Height %d bestHeight %d\n", nFirstBlock, winner.nBlockHeight, pCurrentBlockIndex->nHeight);
int nFirstBlock = pCurrentBlockIndex->nHeight - mnodeman.CountEnabled()*1.25;
if(winner.nBlockHeight < nFirstBlock || winner.nBlockHeight > pCurrentBlockIndex->nHeight+20) {
LogPrint("mnpayments", "MNWINNER -- winner out of range: nFirstBlock=%d, nBlockHeight=%d, nHeight=%d\n", nFirstBlock, winner.nBlockHeight, pCurrentBlockIndex->nHeight);
return;
}
std::string strError = "";
if(!winner.IsValid(pfrom, strError)){
if(strError != "") LogPrint("mnpayments", "mnw - invalid message - %s\n", strError);
if(!winner.IsValid(pfrom, pCurrentBlockIndex->nHeight, strError)) {
LogPrint("mnpayments", "MNWINNER -- invalid message, error: %s\n", strError);
return;
}
if(!CanVote(winner.vinMasternode.prevout, winner.nBlockHeight)){
LogPrintf("mnw - masternode already voted - %s\n", winner.vinMasternode.prevout.ToStringShort());
LogPrintf("MNWINNER -- masternode already voted: prevout=%s\n", winner.vinMasternode.prevout.ToStringShort());
return;
}
if(!winner.SignatureValid()){
LogPrintf("mnw - invalid signature\n");
if(masternodeSync.IsSynced()) Misbehaving(pfrom->GetId(), 20);
if(!winner.SignatureValid()) {
// do not ban for old mnw, MN simply might be not active anymore
if(masternodeSync.IsSynced() && winner.nBlockHeight > pCurrentBlockIndex->nHeight) {
LogPrintf("MNWINNER -- invalid signature\n");
Misbehaving(pfrom->GetId(), 20);
}
// it could just be a non-synced masternode
mnodeman.AskForMN(pfrom, winner.vinMasternode);
return;
@ -255,7 +263,7 @@ void CMasternodePayments::ProcessMessage(CNode* pfrom, std::string& strCommand,
ExtractDestination(winner.payee, address1);
CBitcoinAddress address2(address1);
LogPrint("mnpayments", "mnw - winning vote - Addr %s Height %d bestHeight %d - %s\n", address2.ToString(), winner.nBlockHeight, pCurrentBlockIndex->nHeight, winner.vinMasternode.prevout.ToStringShort());
LogPrint("mnpayments", "MNWINNER -- winning vote: address=%s, nBlockHeight=%d, nHeight=%d, prevout=%s\n", address2.ToString(), winner.nBlockHeight, pCurrentBlockIndex->nHeight, winner.vinMasternode.prevout.ToStringShort());
if(AddWinningMasternode(winner)){
winner.Relay();
@ -464,37 +472,34 @@ void CMasternodePayments::CheckAndRemove()
LogPrintf("CMasternodePayments::CleanPaymentList() - %s mapSeenSyncMNW %lld\n", ToString(), masternodeSync.mapSeenSyncMNW.size());
}
bool CMasternodePaymentWinner::IsValid(CNode* pnode, std::string& strError)
bool CMasternodePaymentWinner::IsValid(CNode* pnode, int nValidationHeight, std::string& strError)
{
CMasternode* pmn = mnodeman.Find(vinMasternode);
if(!pmn)
{
strError = strprintf("Unknown Masternode %s", vinMasternode.prevout.ToStringShort());
LogPrint("mnpayments", "CMasternodePaymentWinner::IsValid - %s\n", strError);
mnodeman.AskForMN(pnode, vinMasternode);
if(!pmn) {
strError = strprintf("Unknown Masternode: prevout=%s", vinMasternode.prevout.ToStringShort());
// Only ask if we are already synced and still have no idea about that Masternode
if (masternodeSync.IsSynced()) mnodeman.AskForMN(pnode, vinMasternode);
return false;
}
if(pmn->protocolVersion < MIN_MNW_PEER_PROTO_VERSION)
{
strError = strprintf("Masternode protocol too old %d - req %d", pmn->protocolVersion, MIN_MNW_PEER_PROTO_VERSION);
LogPrint("mnpayments", "CMasternodePaymentWinner::IsValid - %s\n", strError);
if(pmn->protocolVersion < MIN_MNW_PEER_PROTO_VERSION) {
strError = strprintf("Masternode protocol is too old: protocolVersion=%d, MIN_MNW_PEER_PROTO_VERSION=%d", pmn->protocolVersion, MIN_MNW_PEER_PROTO_VERSION);
return false;
}
int n = mnodeman.GetMasternodeRank(vinMasternode, nBlockHeight-100, MIN_MNW_PEER_PROTO_VERSION);
int nRank = mnodeman.GetMasternodeRank(vinMasternode, nBlockHeight - 100, MIN_MNW_PEER_PROTO_VERSION);
if(n > MNPAYMENTS_SIGNATURES_TOTAL)
{
//It's common to have masternodes mistakenly think they are in the top 10
// We don't want to print all of these messages, or punish them unless they're way off
if(n > MNPAYMENTS_SIGNATURES_TOTAL*2)
{
strError = strprintf("Masternode not in the top %d (%d)", MNPAYMENTS_SIGNATURES_TOTAL, n);
LogPrint("mnpayments", "CMasternodePaymentWinner::IsValid - %s\n", strError);
if(masternodeSync.IsSynced()) Misbehaving(pnode->GetId(), 20);
if(nRank > MNPAYMENTS_SIGNATURES_TOTAL) {
// It's common to have masternodes mistakenly think they are in the top 10
// We don't want to print all of these messages in normal mode, debug mode should print though
strError = strprintf("Masternode is not in the top %d (%d)\n", MNPAYMENTS_SIGNATURES_TOTAL, nRank);
// Only ban for new mnw which is out of bounds, for old mnw MN list itself might be way too much off
if(nRank > MNPAYMENTS_SIGNATURES_TOTAL*2 && nBlockHeight > nValidationHeight) {
LogPrintf("CMasternodePaymentWinner::IsValid -- Error: Masternode is not in the top %d (%d)\n", MNPAYMENTS_SIGNATURES_TOTAL*2, nRank);
Misbehaving(pnode->GetId(), 20);
}
// Still invalid however
return false;
}

View File

@ -161,7 +161,7 @@ public:
}
bool Sign(CKey& keyMasternode, CPubKey& pubKeyMasternode);
bool IsValid(CNode* pnode, std::string& strError);
bool IsValid(CNode* pnode, int nValidationHeight, std::string& strError);
bool SignatureValid();
void Relay();

View File

@ -149,6 +149,8 @@ void CMasternodeSync::GetNextAsset()
LogPrintf("CMasternodeSync::GetNextAsset - Sync has finished\n");
RequestedMasternodeAssets = MASTERNODE_SYNC_FINISHED;
uiInterface.NotifyAdditionalDataSyncProgressChanged(1);
//try to activate our masternode if possible
activeMasternode.ManageStatus();
break;
}
RequestedMasternodeAttempt = 0;
@ -253,20 +255,18 @@ void CMasternodeSync::Process()
}
// INITIAL SYNC SETUP / LOG REPORTING
{
double nSyncProgress = double(RequestedMasternodeAttempt + (RequestedMasternodeAssets - 1) * 8) / (8*4);
LogPrintf("CMasternodeSync::Process() - tick %d RequestedMasternodeAttempt %d RequestedMasternodeAssets %d nSyncProgress %f\n", tick, RequestedMasternodeAttempt, RequestedMasternodeAssets, nSyncProgress);
uiInterface.NotifyAdditionalDataSyncProgressChanged(nSyncProgress);
double nSyncProgress = double(RequestedMasternodeAttempt + (RequestedMasternodeAssets - 1) * 8) / (8*4);
LogPrintf("CMasternodeSync::Process() - tick %d RequestedMasternodeAttempt %d RequestedMasternodeAssets %d nSyncProgress %f\n", tick, RequestedMasternodeAttempt, RequestedMasternodeAssets, nSyncProgress);
uiInterface.NotifyAdditionalDataSyncProgressChanged(nSyncProgress);
if(RequestedMasternodeAssets == MASTERNODE_SYNC_INITIAL) GetNextAsset();
// sporks synced but blockchain is not, wait until we're almost at a recent block to continue
if(Params().NetworkIDString() != CBaseChainParams::REGTEST &&
!IsBlockchainSynced() && RequestedMasternodeAssets > MASTERNODE_SYNC_SPORKS) return;
// sporks synced but blockchain is not, wait until we're almost at a recent block to continue
if(Params().NetworkIDString() != CBaseChainParams::REGTEST &&
!IsBlockchainSynced() && RequestedMasternodeAssets > MASTERNODE_SYNC_SPORKS) return;
TRY_LOCK(cs_vNodes, lockRecv);
if(!lockRecv) return;
TRY_LOCK(cs_vNodes, lockRecv);
if(!lockRecv) return;
}
if(RequestedMasternodeAssets == MASTERNODE_SYNC_INITIAL) GetNextAsset();
BOOST_FOREACH(CNode* pnode, vNodes)
{
@ -293,91 +293,103 @@ void CMasternodeSync::Process()
{
// SPORK : ALWAYS ASK FOR SPORKS AS WE SYNC (we skip this mode now)
if(!pnode->HasFulfilledRequest("spork-sync"))
{
if(!pnode->HasFulfilledRequest("spork-sync")) {
// only request once from each peer
pnode->FulfilledRequest("spork-sync");
// get current network sporks
pnode->PushMessage(NetMsgType::GETSPORKS);
// we always ask for sporks, so just skip this
if(RequestedMasternodeAssets == MASTERNODE_SYNC_SPORKS){
GetNextAsset();
return;
}
if(RequestedMasternodeAssets == MASTERNODE_SYNC_SPORKS) GetNextAsset();
continue; // always get sporks first, switch to the next node without waiting for the next tick
}
// MNLIST : SYNC MASTERNODE LIST FROM OTHER CONNECTED CLIENTS
if(RequestedMasternodeAssets == MASTERNODE_SYNC_LIST)
{
if (pnode->nVersion < mnpayments.GetMinMasternodePaymentsProto()) continue;
// shall we move onto the next asset?
if(nMnCount > mnodeman.GetEstimatedMasternodes(pCurrentBlockIndex->nHeight)*0.9)
{
if(RequestedMasternodeAssets == MASTERNODE_SYNC_LIST) {
// check for timeout first
if(lastMasternodeList < GetTime() - MASTERNODE_SYNC_TIMEOUT) {
LogPrintf("CMasternodeSync::Process -- tick %d asset %d -- timeout\n", tick, RequestedMasternodeAssets);
if(RequestedMasternodeAttempt == 0)
LogPrintf("CMasternodeSync::Process -- WARNING: failed to sync %s\n", GetAssetName());
GetNextAsset();
return;
}
if(lastMasternodeList < GetTime() - MASTERNODE_SYNC_TIMEOUT){ //hasn't received a new item in the last five seconds, so we'll move to the
// check for data
// if we have enough masternodes in or list, switch to the next asset
/* Note: Is this activing up? It's probably related to int CMasternodeMan::GetEstimatedMasternodes(int nBlock)
Surely doesn't work right for testnet currently */
// try to fetch data from at least one peer though
if(RequestedMasternodeAssets > 0 && nMnCount > mnodeman.GetEstimatedMasternodes(pCurrentBlockIndex->nHeight)*0.9) {
LogPrintf("CMasternodeSync::Process -- tick %d asset %d -- found enough data\n", tick, RequestedMasternodeAssets);
GetNextAsset();
return;
}
// requesting is the last thing we do (incase we needed to move to the next asset and we've requested from each peer already)
// only request once from each peer
if(pnode->HasFulfilledRequest("masternode-sync")) continue;
pnode->FulfilledRequest("masternode-sync");
//see if we've synced the masternode list
/* note: Is this activing up? It's probably related to int CMasternodeMan::GetEstimatedMasternodes(int nBlock) */
mnodeman.DsegUpdate(pnode);
if (pnode->nVersion < mnpayments.GetMinMasternodePaymentsProto()) continue;
RequestedMasternodeAttempt++;
mnodeman.DsegUpdate(pnode);
return; //this will cause each peer to get one request each six seconds for the various assets we need
}
// MNW : SYNC MASTERNODE WINNERS FROM OTHER CONNECTED CLIENTS
if(RequestedMasternodeAssets == MASTERNODE_SYNC_MNW)
{
if (pnode->nVersion < mnpayments.GetMinMasternodePaymentsProto()) continue;
// Shall we move onto the next asset?
// --
// This might take a lot longer than 2 minutes due to new blocks, but that's OK. It will eventually time out if needed
if(lastMasternodeWinner < GetTime() - MASTERNODE_SYNC_TIMEOUT){ //hasn't received a new item in the last five seconds, so we'll move to the
if(RequestedMasternodeAssets == MASTERNODE_SYNC_MNW) {
// check for timeout first
// This might take a lot longer than MASTERNODE_SYNC_TIMEOUT minutes due to new blocks,
// but that should be OK and it should timeout eventually.
if(lastMasternodeWinner < GetTime() - MASTERNODE_SYNC_TIMEOUT) {
LogPrintf("CMasternodeSync::Process -- tick %d asset %d -- timeout\n", tick, RequestedMasternodeAssets);
if(RequestedMasternodeAttempt == 0)
LogPrintf("CMasternodeSync::Process -- WARNING: failed to sync %s\n", GetAssetName());
GetNextAsset();
return;
}
// check for data
// if mnpayments already has enough blocks and votes, move to the next asset
if(mnpayments.IsEnoughData(nMnCount)) {
// try to fetch data from at least one peer though
if(RequestedMasternodeAssets > 0 && mnpayments.IsEnoughData(nMnCount)) {
LogPrintf("CMasternodeSync::Process -- tick %d asset %d -- found enough data\n", tick, RequestedMasternodeAssets);
GetNextAsset();
return;
}
// requesting is the last thing we do (incase we needed to move to the next asset and we've requested from each peer already)
// only request once from each peer
if(pnode->HasFulfilledRequest("masternode-winner-sync")) continue;
pnode->FulfilledRequest("masternode-winner-sync");
pnode->PushMessage(NetMsgType::MNWINNERSSYNC, nMnCount); //sync payees
if (pnode->nVersion < mnpayments.GetMinMasternodePaymentsProto()) continue;
RequestedMasternodeAttempt++;
pnode->PushMessage(NetMsgType::MNWINNERSSYNC, nMnCount); //sync payees
return; //this will cause each peer to get one request each six seconds for the various assets we need
}
// GOVOBJ : SYNC GOVERNANCE ITEMS FROM OUR PEERS
if(RequestedMasternodeAssets == MASTERNODE_SYNC_GOVERNANCE){
if (pnode->nVersion < MSG_GOVERNANCE_PEER_PROTO_VERSION) continue;
if(RequestedMasternodeAssets == MASTERNODE_SYNC_GOVERNANCE) {
// check for timeout first
if(lastBudgetItem < GetTime() - MASTERNODE_SYNC_TIMEOUT){
LogPrintf("CMasternodeSync::Process -- tick %d asset %d -- timeout\n", tick, RequestedMasternodeAssets);
if(RequestedMasternodeAttempt == 0)
LogPrintf("CMasternodeSync::Process -- WARNING: failed to sync %s\n", GetAssetName());
GetNextAsset();
return;
}
// shall we move onto the next asset
// check for data
// if(countBudgetItemProp > 0 && countBudgetItemFin)
// {
// if(governance.CountProposalInventoryItems() >= (sumBudgetItemProp / countBudgetItemProp)*0.9)
@ -390,24 +402,17 @@ void CMasternodeSync::Process()
// }
// }
//we'll start rejecting votes if we accidentally get set as synced too soon, this allows plenty of time
if(lastBudgetItem < GetTime() - MASTERNODE_SYNC_TIMEOUT){
GetNextAsset();
//try to activate our masternode if possible
activeMasternode.ManageStatus();
return;
}
// requesting is the last thing we do, incase we needed to move to the next asset and we've requested from each peer already
if (pnode->nVersion < MSG_GOVERNANCE_PEER_PROTO_VERSION) continue;
// only request once from each peer
if(pnode->HasFulfilledRequest("governance-sync")) continue;
pnode->FulfilledRequest("governance-sync");
uint256 n = uint256();
pnode->PushMessage(NetMsgType::MNGOVERNANCESYNC, n); //sync masternode votes
if (pnode->nVersion < MSG_GOVERNANCE_PEER_PROTO_VERSION) continue;
RequestedMasternodeAttempt++;
pnode->PushMessage(NetMsgType::MNGOVERNANCESYNC, uint256()); //sync masternode votes
return; //this will cause each peer to get one request each six seconds for the various assets we need
}
}

View File

@ -317,9 +317,20 @@ public:
uint256 GetHash(){
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
ss << vin;
ss << pubkey;
ss << sigTime;
//
// REMOVE AFTER MIGRATION TO 12.1
//
if(protocolVersion < 70201) {
ss << sigTime;
ss << pubkey;
} else {
//
// END REMOVE
//
ss << vin;
ss << pubkey;
ss << sigTime;
}
return ss.GetHash();
}

View File

@ -586,6 +586,9 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
} else if (strCommand == NetMsgType::DSEG) { //Get Masternode list or specific entry
// ignore such request until we are fully synced
if (!masternodeSync.IsSynced()) return;
CTxIn vin;
vRecv >> vin;

View File

@ -43,11 +43,11 @@ const char *GETSPORKS="getsporks";
const char *MNWINNER="mnw";
const char *MNWINNERSSYNC="mnget";
const char *MNSCANERROR="mn scan error"; // not implemented
const char *MNGOVERNANCESYNC="mnvs";
const char *MNGOVERNANCEVOTE="mvote";
const char *MNGOVERNANCEOBJECT="mprop";
const char *MNGOVERNANCEFINAL="fbs";
const char *MNGOVERNANCEFINALVOTE="fbvote";
const char *MNBUDGETSYNC="mnvs"; // depreciated since 12.1
const char *MNBUDGETVOTE="mvote"; // depreciated since 12.1
const char *MNBUDGETPROPOSAL="mprop"; // depreciated since 12.1
const char *MNBUDGETFINAL="fbs"; // depreciated since 12.1
const char *MNBUDGETFINALVOTE="fbvote"; // depreciated since 12.1
const char *MNQUORUM="mn quorum"; // not implemented
const char *MNANNOUNCE="mnb";
const char *MNPING="mnp";
@ -61,6 +61,9 @@ const char *DSTX="dstx";
const char *DSQUEUE="dsq";
const char *DSEG="dseg";
const char *SYNCSTATUSCOUNT="ssc";
const char *MNGOVERNANCESYNC="govsync";
const char *MNGOVERNANCEOBJECT="govobj";
const char *MNGOVERNANCEOBJECTVOTE="govobjvote";
};
static const char* ppszTypeName[] =
@ -69,20 +72,23 @@ static const char* ppszTypeName[] =
NetMsgType::TX,
NetMsgType::BLOCK,
"filtered block", // Should never occur
// Dash message types
// Dash message types
// NOTE: include non-implmented here, we must keep this list in sync with enum in protocol.h
NetMsgType::IX,
NetMsgType::IXLOCKVOTE,
NetMsgType::SPORK,
NetMsgType::MNWINNER,
NetMsgType::MNSCANERROR, // not implemented
NetMsgType::MNGOVERNANCEVOTE,
NetMsgType::MNGOVERNANCEOBJECT,
NetMsgType::MNGOVERNANCEFINAL,
NetMsgType::MNGOVERNANCEFINALVOTE,
NetMsgType::MNBUDGETVOTE, // depreciated since 12.1
NetMsgType::MNBUDGETPROPOSAL, // depreciated since 12.1
NetMsgType::MNBUDGETFINAL, // depreciated since 12.1
NetMsgType::MNBUDGETFINALVOTE, // depreciated since 12.1
NetMsgType::MNQUORUM, // not implemented
NetMsgType::MNANNOUNCE,
NetMsgType::MNPING,
NetMsgType::DSTX
NetMsgType::DSTX,
NetMsgType::MNGOVERNANCEOBJECT,
NetMsgType::MNGOVERNANCEOBJECTVOTE
};
/** All known message types. Keep this in the same order as the list of
@ -111,18 +117,14 @@ const static std::string allNetMessageTypes[] = {
NetMsgType::FILTERCLEAR,
NetMsgType::REJECT,
NetMsgType::SENDHEADERS,
// Dash message types
// Dash message types
// NOTE: do NOT include non-implmented here, we want them to be "Unknown command" in ProcessMessage()
NetMsgType::IX,
NetMsgType::IXLOCKVOTE,
NetMsgType::SPORK,
NetMsgType::GETSPORKS,
NetMsgType::MNWINNER,
NetMsgType::MNWINNERSSYNC,
NetMsgType::MNGOVERNANCESYNC,
NetMsgType::MNGOVERNANCEVOTE,
NetMsgType::MNGOVERNANCEOBJECT,
NetMsgType::MNGOVERNANCEFINAL,
NetMsgType::MNGOVERNANCEFINALVOTE,
NetMsgType::MNANNOUNCE,
NetMsgType::MNPING,
NetMsgType::DSACCEPT,
@ -134,7 +136,10 @@ const static std::string allNetMessageTypes[] = {
NetMsgType::DSTX,
NetMsgType::DSQUEUE,
NetMsgType::DSEG,
NetMsgType::SYNCSTATUSCOUNT
NetMsgType::SYNCSTATUSCOUNT,
NetMsgType::MNGOVERNANCESYNC,
NetMsgType::MNGOVERNANCEOBJECT,
NetMsgType::MNGOVERNANCEOBJECTVOTE
};
const static std::vector<std::string> allNetMessageTypesVec(allNetMessageTypes, allNetMessageTypes+ARRAYLEN(allNetMessageTypes));

View File

@ -220,6 +220,7 @@ extern const char *REJECT;
extern const char *SENDHEADERS;
// Dash message types
// NOTE: do NOT declare non-implmented here, we don't want them to be exposed to the outside
// TODO: add description
extern const char *IX;
extern const char *IXLOCKVOTE;
@ -227,11 +228,6 @@ extern const char *SPORK;
extern const char *GETSPORKS;
extern const char *MNWINNER;
extern const char *MNWINNERSSYNC;
extern const char *MNGOVERNANCESYNC;
extern const char *MNGOVERNANCEVOTE;
extern const char *MNGOVERNANCEOBJECT;
extern const char *MNGOVERNANCEFINAL;
extern const char *MNGOVERNANCEFINALVOTE;
extern const char *MNANNOUNCE;
extern const char *MNPING;
extern const char *DSACCEPT;
@ -244,6 +240,9 @@ extern const char *DSTX;
extern const char *DSQUEUE;
extern const char *DSEG;
extern const char *SYNCSTATUSCOUNT;
extern const char *MNGOVERNANCESYNC;
extern const char *MNGOVERNANCEOBJECT;
extern const char *MNGOVERNANCEOBJECTVOTE;
};
/* Get a vector of all valid message types (see above) */
@ -343,17 +342,21 @@ enum {
MSG_FILTERED_BLOCK,
MSG_TXLOCK_REQUEST,
MSG_TXLOCK_VOTE,
// Dash message types
// NOTE: declare non-implmented here, we must keep this enum consistent and backwards compatible
MSG_SPORK,
MSG_MASTERNODE_WINNER,
MSG_MASTERNODE_SCANNING_ERROR, // not implemented
MSG_GOVERNANCE_VOTE,
MSG_GOVERNANCE_OBJECT,
MSG_BUDGET_FINALIZED,
MSG_BUDGET_FINALIZED_VOTE,
MSG_BUDGET_VOTE, // depreciated since 12.1
MSG_BUDGET_PROPOSAL, // depreciated since 12.1
MSG_BUDGET_FINALIZED, // depreciated since 12.1
MSG_BUDGET_FINALIZED_VOTE, // depreciated since 12.1
MSG_MASTERNODE_QUORUM, // not implemented
MSG_MASTERNODE_ANNOUNCE,
MSG_MASTERNODE_PING,
MSG_DSTX
MSG_DSTX,
MSG_GOVERNANCE_OBJECT,
MSG_GOVERNANCE_OBJECT_VOTE
};
#endif // BITCOIN_PROTOCOL_H