mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
fix: correct conditions for YES voting
This commit is contained in:
parent
ec1392c6de
commit
3d75390e4e
@ -746,9 +746,11 @@ void CGovernanceManager::VoteGovernanceTriggers(const std::optional<const CGover
|
|||||||
assert(!votedFundingYesTriggerHash.has_value());
|
assert(!votedFundingYesTriggerHash.has_value());
|
||||||
// Vote YES-FUNDING for the trigger we like, unless we already did
|
// Vote YES-FUNDING for the trigger we like, unless we already did
|
||||||
const uint256 gov_sb_hash = trigger_opt.value().GetHash();
|
const uint256 gov_sb_hash = trigger_opt.value().GetHash();
|
||||||
|
bool voted_already{false};
|
||||||
if (vote_rec_t voteRecord; trigger_opt.value().GetCurrentMNVotes(mn_activeman.GetOutPoint(), voteRecord)) {
|
if (vote_rec_t voteRecord; trigger_opt.value().GetCurrentMNVotes(mn_activeman.GetOutPoint(), voteRecord)) {
|
||||||
const auto& strFunc = __func__;
|
const auto& strFunc = __func__;
|
||||||
ranges::any_of(voteRecord.mapInstances, [&](const auto& voteInstancePair) {
|
// Let's see if there is a VOTE_SIGNAL_FUNDING vote from us already
|
||||||
|
voted_already = ranges::any_of(voteRecord.mapInstances, [&](const auto& voteInstancePair) {
|
||||||
if (voteInstancePair.first == VOTE_SIGNAL_FUNDING) {
|
if (voteInstancePair.first == VOTE_SIGNAL_FUNDING) {
|
||||||
if (voteInstancePair.second.eOutcome == VOTE_OUTCOME_YES) {
|
if (voteInstancePair.second.eOutcome == VOTE_OUTCOME_YES) {
|
||||||
votedFundingYesTriggerHash = gov_sb_hash;
|
votedFundingYesTriggerHash = gov_sb_hash;
|
||||||
@ -762,14 +764,19 @@ void CGovernanceManager::VoteGovernanceTriggers(const std::optional<const CGover
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
} else if (VoteFundingTrigger(gov_sb_hash, VOTE_OUTCOME_YES, connman, peerman, mn_activeman)) {
|
}
|
||||||
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s Voting YES-FUNDING for new trigger:%s success\n", __func__,
|
if (!voted_already) {
|
||||||
gov_sb_hash.ToString());
|
// No previous VOTE_SIGNAL_FUNDING was found, vote now
|
||||||
votedFundingYesTriggerHash = gov_sb_hash;
|
if (VoteFundingTrigger(gov_sb_hash, VOTE_OUTCOME_YES, connman, peerman, mn_activeman)) {
|
||||||
} else {
|
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s Voting YES-FUNDING for new trigger:%s success\n",
|
||||||
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s Voting YES-FUNDING for new trigger:%s failed\n", __func__, gov_sb_hash.ToString());
|
__func__, gov_sb_hash.ToString());
|
||||||
// this should never happen, bail out
|
votedFundingYesTriggerHash = gov_sb_hash;
|
||||||
return;
|
} else {
|
||||||
|
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s Voting YES-FUNDING for new trigger:%s failed\n",
|
||||||
|
__func__, gov_sb_hash.ToString());
|
||||||
|
// this should never happen, bail out
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user