Fix netfulfilledman usage (#2033)
* drop CMasternodeSync::ClearFulfilledRequests() * Cleanup netfulfilledman periodically * Do not expose RemoveFulfilledRequest()
This commit is contained in:
parent
53093c65be
commit
a37dbd6d2b
@ -64,12 +64,10 @@ void CMasternodeSync::SwitchToNextAsset(CConnman& connman)
|
||||
throw std::runtime_error("Can't switch to next asset from failed, should use Reset() first!");
|
||||
break;
|
||||
case(MASTERNODE_SYNC_INITIAL):
|
||||
ClearFulfilledRequests(connman);
|
||||
nRequestedMasternodeAssets = MASTERNODE_SYNC_WAITING;
|
||||
LogPrintf("CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName());
|
||||
break;
|
||||
case(MASTERNODE_SYNC_WAITING):
|
||||
ClearFulfilledRequests(connman);
|
||||
LogPrintf("CMasternodeSync::SwitchToNextAsset -- Completed %s in %llds\n", GetAssetName(), GetTime() - nTimeAssetSyncStarted);
|
||||
nRequestedMasternodeAssets = MASTERNODE_SYNC_LIST;
|
||||
LogPrintf("CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName());
|
||||
@ -132,17 +130,6 @@ void CMasternodeSync::ProcessMessage(CNode* pfrom, const std::string& strCommand
|
||||
}
|
||||
}
|
||||
|
||||
void CMasternodeSync::ClearFulfilledRequests(CConnman& connman)
|
||||
{
|
||||
connman.ForEachNode(CConnman::AllNodes, [](CNode* pnode) {
|
||||
netfulfilledman.RemoveFulfilledRequest(pnode->addr, "spork-sync");
|
||||
netfulfilledman.RemoveFulfilledRequest(pnode->addr, "masternode-list-sync");
|
||||
netfulfilledman.RemoveFulfilledRequest(pnode->addr, "masternode-payment-sync");
|
||||
netfulfilledman.RemoveFulfilledRequest(pnode->addr, "governance-sync");
|
||||
netfulfilledman.RemoveFulfilledRequest(pnode->addr, "full-sync");
|
||||
});
|
||||
}
|
||||
|
||||
void CMasternodeSync::ProcessTick(CConnman& connman)
|
||||
{
|
||||
static int nTick = 0;
|
||||
|
@ -48,7 +48,6 @@ private:
|
||||
int64_t nTimeLastFailure;
|
||||
|
||||
void Fail();
|
||||
void ClearFulfilledRequests(CConnman& connman);
|
||||
|
||||
public:
|
||||
CMasternodeSync() { Reset(); }
|
||||
|
@ -24,6 +24,8 @@ private:
|
||||
fulfilledreqmap_t mapFulfilledRequests;
|
||||
CCriticalSection cs_mapFulfilledRequests;
|
||||
|
||||
void RemoveFulfilledRequest(const CService& addr, const std::string& strRequest);
|
||||
|
||||
public:
|
||||
CNetFulfilledRequestManager() {}
|
||||
|
||||
@ -37,7 +39,6 @@ public:
|
||||
|
||||
void AddFulfilledRequest(const CService& addr, const std::string& strRequest);
|
||||
bool HasFulfilledRequest(const CService& addr, const std::string& strRequest);
|
||||
void RemoveFulfilledRequest(const CService& addr, const std::string& strRequest);
|
||||
|
||||
void CheckAndRemove();
|
||||
void Clear();
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "masternode-sync.h"
|
||||
#include "masternodeman.h"
|
||||
#include "messagesigner.h"
|
||||
#include "netfulfilledman.h"
|
||||
#include "netmessagemaker.h"
|
||||
#include "script/sign.h"
|
||||
#include "txmempool.h"
|
||||
@ -545,6 +546,7 @@ void ThreadCheckPrivateSend(CConnman& connman)
|
||||
activeMasternode.ManageState(connman);
|
||||
|
||||
if(nTick % 60 == 0) {
|
||||
netfulfilledman.CheckAndRemove();
|
||||
mnodeman.ProcessMasternodeConnections(connman);
|
||||
mnodeman.CheckAndRemove(connman);
|
||||
mnodeman.WarnMasternodeDaemonUpdates();
|
||||
|
Loading…
Reference in New Issue
Block a user