mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
patch from @udjinm6 -- extract hash calc from loop (#1119)
calculate hash once before entering loop, should make it around an order of magnitude faster
This commit is contained in:
parent
b3f14b3c30
commit
4894345a58
@ -1125,12 +1125,13 @@ int CGovernanceManager::CountMatchingVotes(CGovernanceObject& govobj, vote_signa
|
|||||||
LOCK(cs);
|
LOCK(cs);
|
||||||
int nCount = 0;
|
int nCount = 0;
|
||||||
|
|
||||||
|
uint256 hash = govobj.GetHash();
|
||||||
std::map<uint256, CGovernanceVote>::iterator it = mapVotesByType.begin();
|
std::map<uint256, CGovernanceVote>::iterator it = mapVotesByType.begin();
|
||||||
while(it != mapVotesByType.end()) {
|
while(it != mapVotesByType.end()) {
|
||||||
if(it->second.IsValid() &&
|
if(it->second.IsValid() &&
|
||||||
it->second.GetSignal() == eVoteSignalIn &&
|
it->second.GetSignal() == eVoteSignalIn &&
|
||||||
it->second.GetOutcome() == eVoteOutcomeIn &&
|
it->second.GetOutcome() == eVoteOutcomeIn &&
|
||||||
it->second.GetParentHash() == govobj.GetHash()) {
|
it->second.GetParentHash() == hash) {
|
||||||
++nCount;
|
++nCount;
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
|
Loading…
Reference in New Issue
Block a user