Skip to content

Commit

Permalink
Merge pull request #1974 from cyrossignol/fix-votedetails-rpc
Browse files Browse the repository at this point in the history
rpc: Fix answer offset in "votedetails"
  • Loading branch information
jamescowens authored Nov 18, 2020
2 parents d2697bf + eaca6c3 commit 3ea7b6d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/rpcvoting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ UniValue VoteDetailsToJson(const PollResult& result)
UniValue answers(UniValue::VARR);
PollResult::Weight total_weight = 0;

for (size_t i = 0; i < detail.m_responses.size(); ++i) {
for (const auto& answer_pair : detail.m_responses) {
UniValue answer(UniValue::VOBJ);
answer.pushKV("id", (int)i);
answer.pushKV("weight", ValueFromAmount(detail.m_responses[i].second));
answer.pushKV("id", (int)answer_pair.first);
answer.pushKV("weight", ValueFromAmount(answer_pair.second));

total_weight += detail.m_responses[i].second;
total_weight += answer_pair.second;
answers.push_back(answer);
}

Expand Down

0 comments on commit 3ea7b6d

Please sign in to comment.