TODO: Rename/move to core
| 2101 | |
| 2102 | //TODO: Rename/move to core |
| 2103 | void ThreadCheckDarkSendPool() { |
| 2104 | // Make this thread recognisable as the wallet flushing thread |
| 2105 | RenameThread("Lux-darksend"); |
| 2106 | |
| 2107 | unsigned int c = 0; |
| 2108 | std::string errorMessage; |
| 2109 | |
| 2110 | while (!ShutdownRequested()) { |
| 2111 | c++; |
| 2112 | |
| 2113 | MilliSleep(2500); |
| 2114 | //LogPrintf("ThreadCheckDarkSendPool::check timeout\n"); |
| 2115 | darkSendPool.CheckTimeout(); |
| 2116 | |
| 2117 | if (c % 60 == 0) { |
| 2118 | { |
| 2119 | LOCK(cs_masternodes); |
| 2120 | vector<CMasterNode>::iterator it = vecMasternodes.begin(); |
| 2121 | //check them separately |
| 2122 | while (it != vecMasternodes.end()) { |
| 2123 | (*it).Check(); |
| 2124 | if ((*it).enabled == 4 || (*it).enabled == 3) { |
| 2125 | LogPrintf("Removing inactive masternode %s\n", (*it).addr.ToString().c_str()); |
| 2126 | it = vecMasternodes.erase(it); |
| 2127 | } else { |
| 2128 | ++it; |
| 2129 | } |
| 2130 | } |
| 2131 | } |
| 2132 | masternodePayments.CleanPaymentList(); |
| 2133 | CleanTransactionLocksList(); |
| 2134 | } |
| 2135 | |
| 2136 | //try to sync the masternode list and payment list every 5 seconds from at least 5 nodes |
| 2137 | if (c % 5 == 0 && RequestedMasterNodeList < 5) { |
| 2138 | bool fIsInitialDownload = IsInitialBlockDownload(); |
| 2139 | if (!fIsInitialDownload) { |
| 2140 | LOCK(cs_vNodes); |
| 2141 | for (CNode * pnode : vNodes) { |
| 2142 | if (pnode && pnode->nVersion >= darkSendPool.MIN_PEER_PROTO_VERSION) { |
| 2143 | |
| 2144 | //keep track of who we've asked for the list |
| 2145 | if (pnode->HasFulfilledRequest("mnsync")) continue; |
| 2146 | pnode->FulfilledRequest("mnsync"); |
| 2147 | |
| 2148 | LogPrintf("Successfully synced, asking for Masternode list and payment list\n"); |
| 2149 | |
| 2150 | pnode->PushMessage("dseg", CTxIn()); //request full mn list |
| 2151 | pnode->PushMessage("mnget"); //sync payees |
| 2152 | pnode->PushMessage("getsporks"); //get current network sporks |
| 2153 | RequestedMasterNodeList++; |
| 2154 | } |
| 2155 | } |
| 2156 | } |
| 2157 | } |
| 2158 | |
| 2159 | if (c % MASTERNODE_PING_SECONDS == 0) { |
| 2160 | activeMasternode.ManageStatus(); |
nothing calls this directly
no test coverage detected