@@ -55,7 +55,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
5555 if (IsInitialBlockDownload ()) return ;
5656
5757 if (strCommand == " dsf" ) { // DarkSend Final tx
58- if (pfrom->nVersion < darkSendPool. MIN_PEER_PROTO_VERSION ) {
58+ if (pfrom->nVersion < MIN_POOL_PEER_PROTO_VERSION ) {
5959 return ;
6060 }
6161
@@ -78,7 +78,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
7878 }
7979
8080 else if (strCommand == " dsc" ) { // DarkSend Complete
81- if (pfrom->nVersion < darkSendPool. MIN_PEER_PROTO_VERSION ) {
81+ if (pfrom->nVersion < MIN_POOL_PEER_PROTO_VERSION ) {
8282 return ;
8383 }
8484
@@ -102,7 +102,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
102102
103103 else if (strCommand == " dsa" ) { // DarkSend Acceptable
104104
105- if (pfrom->nVersion < darkSendPool. MIN_PEER_PROTO_VERSION ) {
105+ if (pfrom->nVersion < MIN_POOL_PEER_PROTO_VERSION ) {
106106 std::string strError = _ (" Incompatible version." );
107107 LogPrintf (" dsa -- incompatible version! \n " );
108108 pfrom->PushMessage (" dssu" , darkSendPool.sessionID , darkSendPool.GetState (), darkSendPool.GetEntriesCount (), MASTERNODE_REJECTED , strError);
@@ -133,7 +133,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
133133
134134 if (darkSendPool.sessionUsers == 0 ) {
135135 if (pmn->nLastDsq != 0 &&
136- pmn->nLastDsq + mnodeman.CountMasternodesAboveProtocol (darkSendPool. MIN_PEER_PROTO_VERSION )/5 > darkSendPool.nDsqCount ){
136+ pmn->nLastDsq + mnodeman.CountMasternodesAboveProtocol (MIN_POOL_PEER_PROTO_VERSION )/5 > darkSendPool.nDsqCount ){
137137 LogPrintf (" dsa -- last dsq too recent, must wait. %s \n " , pmn->addr .ToString ().c_str ()); std::string strError = _ (" Last Darksend was too recent." );
138138 pfrom->PushMessage (" dssu" , darkSendPool.sessionID , darkSendPool.GetState (), darkSendPool.GetEntriesCount (), MASTERNODE_REJECTED , strError);
139139 return ;
@@ -152,7 +152,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
152152 }
153153 } else if (strCommand == " dsq" ) { // DarkSend Queue
154154
155- if (pfrom->nVersion < darkSendPool. MIN_PEER_PROTO_VERSION ) {
155+ if (pfrom->nVersion < MIN_POOL_PEER_PROTO_VERSION ) {
156156 return ;
157157 }
158158
@@ -186,7 +186,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
186186 if (fDebug ) LogPrintf (" dsq last %d last2 %d count %d\n " , pmn->nLastDsq , pmn->nLastDsq + mnodeman.size ()/5 , darkSendPool.nDsqCount );
187187 // don't allow a few nodes to dominate the queuing process
188188 if (pmn->nLastDsq != 0 &&
189- pmn->nLastDsq + mnodeman.CountMasternodesAboveProtocol (darkSendPool. MIN_PEER_PROTO_VERSION )/5 > darkSendPool.nDsqCount ){
189+ pmn->nLastDsq + mnodeman.CountMasternodesAboveProtocol (MIN_POOL_PEER_PROTO_VERSION )/5 > darkSendPool.nDsqCount ){
190190 if (fDebug ) LogPrintf (" dsq -- masternode sending too many dsq messages. %s \n " , pmn->addr .ToString ().c_str ());
191191 return ;
192192 }
@@ -202,7 +202,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
202202
203203 } else if (strCommand == " dsi" ) { // DarkSend vIn
204204 std::string error = " " ;
205- if (pfrom->nVersion < darkSendPool. MIN_PEER_PROTO_VERSION ) {
205+ if (pfrom->nVersion < MIN_POOL_PEER_PROTO_VERSION ) {
206206 LogPrintf (" dsi -- incompatible version! \n " );
207207 error = _ (" Incompatible version." );
208208 pfrom->PushMessage (" dssu" , darkSendPool.sessionID , darkSendPool.GetState (), darkSendPool.GetEntriesCount (), MASTERNODE_REJECTED , error);
@@ -327,7 +327,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
327327 }
328328
329329 else if (strCommand == " dssub" ) { // DarkSend Subscribe To
330- if (pfrom->nVersion < darkSendPool. MIN_PEER_PROTO_VERSION ) {
330+ if (pfrom->nVersion < MIN_POOL_PEER_PROTO_VERSION ) {
331331 return ;
332332 }
333333
@@ -340,7 +340,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
340340
341341 else if (strCommand == " dssu" ) { // DarkSend status update
342342
343- if (pfrom->nVersion < darkSendPool. MIN_PEER_PROTO_VERSION ) {
343+ if (pfrom->nVersion < MIN_POOL_PEER_PROTO_VERSION ) {
344344 return ;
345345 }
346346
@@ -368,7 +368,7 @@ void ProcessMessageDarksend(CNode* pfrom, std::string& strCommand, CDataStream&
368368 }
369369
370370 else if (strCommand == " dss" ) { // DarkSend Sign Final Tx
371- if (pfrom->nVersion < darkSendPool. MIN_PEER_PROTO_VERSION ) {
371+ if (pfrom->nVersion < MIN_POOL_PEER_PROTO_VERSION ) {
372372 return ;
373373 }
374374
@@ -1039,7 +1039,8 @@ bool CDarkSendPool::IsCollateralValid(const CTransaction& txCollateral){
10391039
10401040 CValidationState state;
10411041 // if(!AcceptableInputs(mempool, state, txCollateral)){
1042- bool * pfMissingInputs = false ;
1042+ bool * pfMissingInputs = new bool ;
1043+ *pfMissingInputs = false ;
10431044 if (!AcceptableInputs (mempool, txCollateral, false , pfMissingInputs)){
10441045 if (fDebug ) LogPrintf (" CDarkSendPool::IsCollateralValid - didn't pass IsAcceptable\n " );
10451046 return false ;
@@ -1548,7 +1549,7 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready)
15481549
15491550 int protocolVersion;
15501551 if (!dsq.GetProtocolVersion (protocolVersion)) continue ;
1551- if (protocolVersion < MIN_PEER_PROTO_VERSION ) continue ;
1552+ if (protocolVersion < MIN_POOL_PEER_PROTO_VERSION ) continue ;
15521553
15531554 // non-denom's are incompatible
15541555 if ((dsq.nDenom & (1 << 4 ))) continue ;
@@ -1610,7 +1611,7 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready)
16101611 if (pmn == NULL )
16111612 {
16121613 LogPrintf (" DoAutomaticDenominating --- masternode list is empty!\n " );
1613- return false ;
1614+ return false ;
16141615 }
16151616 // don't reuse masternodes
16161617 BOOST_FOREACH (CTxIn usedVin, vecMasternodesUsed) {
@@ -1619,13 +1620,13 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready)
16191620 continue ;
16201621 }
16211622 }
1622- if (pmn->protocolVersion < darkSendPool. MIN_PEER_PROTO_VERSION ) {
1623+ if (pmn->protocolVersion < MIN_POOL_PEER_PROTO_VERSION ) {
16231624 i++;
16241625 continue ;
16251626 }
16261627
16271628 if (pmn->nLastDsq != 0 &&
1628- pmn->nLastDsq + mnodeman.CountMasternodesAboveProtocol (darkSendPool. MIN_PEER_PROTO_VERSION )/5 > darkSendPool.nDsqCount ){
1629+ pmn->nLastDsq + mnodeman.CountMasternodesAboveProtocol (MIN_POOL_PEER_PROTO_VERSION )/5 > darkSendPool.nDsqCount ){
16291630 i++;
16301631 continue ;
16311632 }
@@ -2185,25 +2186,18 @@ void ThreadCheckDarkSendPool()
21852186 MilliSleep (2500 );
21862187 // LogPrintf("ThreadCheckDarkSendPool::check timeout\n");
21872188 darkSendPool.CheckTimeout ();
2188-
2189- if (c % 60 == 0 ){
2189+ if (c % 60 == 0 )
2190+ {
2191+ LOCK (cs_main);
2192+ /*
2193+ cs_main is required for doing CMasternode.Check because something
2194+ is modifying the coins view without a mempool lock. It causes
2195+ segfaults from this code without the cs_main lock.
2196+ */
2197+ mnodeman.CheckAndRemove ();
21902198 darkSendPool.ProcessMasternodeConnections ();
21912199 masternodePayments.CleanPaymentList ();
21922200 CleanTransactionLocksList ();
2193-
2194- // nodes refuse to relay dseep if it was less then MASTERNODE_MIN_DSEEP_SECONDS ago
2195- // MASTERNODE_PING_WAIT_SECONDS gives some additional time on top of it
2196- // so we have a timeout for this check on start unless we need to
2197- if (c > MASTERNODE_MIN_DSEEP_SECONDS + MASTERNODE_PING_WAIT_SECONDS || mnodeman.UpdateNeeded ())
2198- {
2199- LOCK (cs_main);
2200- /*
2201- cs_main is required for doing CMasternode.Check because something
2202- is modifying the coins view without a mempool lock. It causes
2203- segfaults from this code without the cs_main lock.
2204- */
2205- mnodeman.CheckAndRemove ();
2206- }
22072201 }
22082202
22092203 if (c % MASTERNODE_PING_SECONDS == 0 ) activeMasternode.ManageStatus ();
@@ -2217,7 +2211,7 @@ void ThreadCheckDarkSendPool()
22172211 LOCK (cs_vNodes);
22182212 BOOST_FOREACH (CNode* pnode, vNodes)
22192213 {
2220- if (pnode->nVersion >= darkSendPool. MIN_PEER_PROTO_VERSION ) {
2214+ if (pnode->nVersion >= MIN_POOL_PEER_PROTO_VERSION ) {
22212215
22222216 // keep track of who we've asked for the list
22232217 if (pnode->HasFulfilledRequest (" mnsync" )) continue ;
@@ -2226,7 +2220,7 @@ void ThreadCheckDarkSendPool()
22262220 LogPrintf (" Successfully synced, asking for Masternode list and payment list\n " );
22272221
22282222 // request full mn list only if masternodes.dat was updated quite a long time ago
2229- if ( mnodeman.UpdateNeeded ()) pnode-> PushMessage ( " dseg " , CTxIn () );
2223+ mnodeman.DsegUpdate ( pnode);
22302224
22312225 pnode->PushMessage (" mnget" ); // sync payees
22322226 pnode->PushMessage (" getsporks" ); // get current network sporks
0 commit comments