Skip to content

Commit af3cea2

Browse files
committed
[Budget] Fix DMN Voting
1 parent 08442d5 commit af3cea2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/qt/pivx/governancemodel.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
#include "budget/budgetutil.h"
99
#include "destination_io.h"
1010
#include "guiconstants.h"
11+
#include "optional.h"
1112
#include "qt/transactiontablemodel.h"
1213
#include "qt/transactionrecord.h"
1314
#include "qt/pivx/mnmodel.h"
1415
#include "tiertwo/tiertwo_sync_state.h"
1516
#include "utilmoneystr.h"
1617
#include "utilstrencodings.h"
18+
#include "wallet/wallet.h" // TODO: Move to walletModel
1719
#include "walletmodel.h"
1820

1921
#include <algorithm>
@@ -262,14 +264,15 @@ OperationResult GovernanceModel::voteForProposal(const ProposalInfo& prop,
262264
const std::vector<std::string>& mnVotingAlias)
263265
{
264266
UniValue ret; // future: don't use UniValue here.
267+
auto p_wallet = vpwallets[0]; // TODO: Move to walletModel
268+
bool fLegacyMN = walletModel->isRegTestNetwork() ? false : true; // For now, only DMN on regtest
265269
for (const auto& mnAlias : mnVotingAlias) {
266-
bool fLegacyMN = true; // For now, only legacy MNs
267-
ret = mnBudgetVoteInner(nullptr,
270+
ret = mnBudgetVoteInner(p_wallet,
268271
fLegacyMN,
269272
prop.id,
270273
false,
271274
isVotePositive ? CBudgetVote::VoteDirection::VOTE_YES : CBudgetVote::VoteDirection::VOTE_NO,
272-
mnAlias);
275+
fLegacyMN ? mnAlias : boost::optional<std::string>{});
273276
if (ret.exists("detail") && ret["detail"].isArray()) {
274277
const UniValue& obj = ret["detail"].get_array()[0];
275278
if (obj["result"].getValStr() != "success") {

0 commit comments

Comments
 (0)