mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Fix governance.cpp
This commit is contained in:
parent
29d3b75f28
commit
56da433bd9
@ -1033,8 +1033,8 @@ int CGovernanceManager::RequestGovernanceObjectVotes(const std::vector<CNode*>&
|
||||
// stop early to prevent setAskFor overflow
|
||||
{
|
||||
LOCK(cs_main);
|
||||
size_t nProjectedSize = pnode->setAskFor.size() + nProjectedVotes;
|
||||
if (nProjectedSize > SETASKFOR_MAX_SZ / 2) continue;
|
||||
size_t nProjectedSize = GetRequestedObjectCount(pnode->GetId()) + nProjectedVotes;
|
||||
if (nProjectedSize > MAX_INV_SZ) continue;
|
||||
// to early to ask the same node
|
||||
if (mapAskedRecently[nHashGovobj].count(pnode->addr)) continue;
|
||||
}
|
||||
|
@ -735,6 +735,16 @@ void RequestObject(NodeId nodeId, const CInv& inv, int64_t nNow) EXCLUSIVE_LOCKS
|
||||
RequestObject(state, inv, nNow);
|
||||
}
|
||||
|
||||
size_t GetRequestedObjectCount(NodeId nodeId)
|
||||
{
|
||||
AssertLockHeld(cs_main);
|
||||
auto* state = State(nodeId);
|
||||
if (!state) {
|
||||
return 0;
|
||||
}
|
||||
return state->m_tx_download.m_tx_process_time.size();
|
||||
}
|
||||
|
||||
// This function is used for testing the stale tip eviction logic, see
|
||||
// DoS_tests.cpp
|
||||
void UpdateLastBlockAnnounceTime(NodeId node, int64_t time_in_seconds)
|
||||
|
@ -86,5 +86,6 @@ bool IsBanned(NodeId nodeid);
|
||||
|
||||
void EraseObjectRequest(const uint256& hash);
|
||||
void RequestObject(NodeId nodeId, const CInv& inv, int64_t nNow);
|
||||
size_t GetRequestedObjectCount(NodeId nodeId);
|
||||
|
||||
#endif // BITCOIN_NET_PROCESSING_H
|
||||
|
Loading…
Reference in New Issue
Block a user