Add more Private Send minimum protocol version checking (#1073)

This commit is contained in:
TheLazieR Yip 2016-10-13 16:45:30 +07:00 committed by UdjinM6
parent d5dcf2b668
commit 27c445a891

View File

@ -1564,7 +1564,7 @@ bool CDarksendPool::DoAutomaticDenominating(bool fDryRun)
nLastTimeChanged = GetTimeMillis(); nLastTimeChanged = GetTimeMillis();
// connect to Masternode and submit the queue request // connect to Masternode and submit the queue request
CNode* pnode = ConnectNode((CAddress)addr, NULL, true); CNode* pnode = ConnectNode((CAddress)addr, NULL, true);
if(pnode != NULL) { if(pnode != NULL && pnode->nVersion >= MIN_PRIVATESEND_PEER_PROTO_VERSION) {
pSubmittedToMasternode = pmn; pSubmittedToMasternode = pmn;
nSessionDenom = dsq.nDenom; nSessionDenom = dsq.nDenom;
@ -1605,7 +1605,7 @@ bool CDarksendPool::DoAutomaticDenominating(bool fDryRun)
nLastTimeChanged = GetTimeMillis(); nLastTimeChanged = GetTimeMillis();
LogPrintf("CDarksendPool::DoAutomaticDenominating -- attempt %d connection to Masternode %s\n", nTries, pmn->addr.ToString()); LogPrintf("CDarksendPool::DoAutomaticDenominating -- attempt %d connection to Masternode %s\n", nTries, pmn->addr.ToString());
CNode* pnode = ConnectNode((CAddress)pmn->addr, NULL, true); CNode* pnode = ConnectNode((CAddress)pmn->addr, NULL, true);
if(pnode != NULL) { if(pnode != NULL && pnode->nVersion >= MIN_PRIVATESEND_PEER_PROTO_VERSION) {
LogPrintf("CDarksendPool::DoAutomaticDenominating -- connected %s\n", pmn->vin.ToString()); LogPrintf("CDarksendPool::DoAutomaticDenominating -- connected %s\n", pmn->vin.ToString());
pSubmittedToMasternode = pmn; pSubmittedToMasternode = pmn;
@ -2326,6 +2326,7 @@ bool CDarksendQueue::Relay()
{ {
LOCK(cs_vNodes); LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes) BOOST_FOREACH(CNode* pnode, vNodes)
if(pnode->nVersion >= MIN_PRIVATESEND_PEER_PROTO_VERSION)
pnode->PushMessage(NetMsgType::DSQUEUE, (*this)); pnode->PushMessage(NetMsgType::DSQUEUE, (*this));
return true; return true;
@ -2365,6 +2366,7 @@ void CDarksendPool::RelayFinalTransaction(const CTransaction& txFinal)
{ {
LOCK(cs_vNodes); LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes) BOOST_FOREACH(CNode* pnode, vNodes)
if(pnode->nVersion >= MIN_PRIVATESEND_PEER_PROTO_VERSION)
pnode->PushMessage(NetMsgType::DSFINALTX, nSessionID, txFinal); pnode->PushMessage(NetMsgType::DSFINALTX, nSessionID, txFinal);
} }
@ -2383,6 +2385,7 @@ void CDarksendPool::RelayStatus(int nErrorID)
{ {
LOCK(cs_vNodes); LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes) BOOST_FOREACH(CNode* pnode, vNodes)
if(pnode->nVersion >= MIN_PRIVATESEND_PEER_PROTO_VERSION)
pnode->PushMessage(NetMsgType::DSSTATUSUPDATE, nSessionID, nState, nEntriesCount, nAcceptedEntriesCount, nErrorID); pnode->PushMessage(NetMsgType::DSSTATUSUPDATE, nSessionID, nState, nEntriesCount, nAcceptedEntriesCount, nErrorID);
} }
@ -2390,6 +2393,7 @@ void CDarksendPool::RelayCompletedTransaction(bool fError, int nErrorID)
{ {
LOCK(cs_vNodes); LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes) BOOST_FOREACH(CNode* pnode, vNodes)
if(pnode->nVersion >= MIN_PRIVATESEND_PEER_PROTO_VERSION)
pnode->PushMessage(NetMsgType::DSCOMPLETE, nSessionID, fError, nErrorID); pnode->PushMessage(NetMsgType::DSCOMPLETE, nSessionID, fError, nErrorID);
} }