Only return own contributions in listCurrentStakes()

This is currently returning all contributions in all service nodes you
are staked to, which causes the mobile wallet to list everyone's stakes
in multi-contribution service nodes as your own.
This commit is contained in:
Jason Rhinelander 2022-04-13 19:34:20 -03:00
parent 4f15cd832b
commit b5276f0648
No known key found for this signature in database
GPG Key ID: C4992CE7A88D4262
1 changed files with 5 additions and 6 deletions

View File

@ -1078,14 +1078,13 @@ std::vector<std::pair<std::string, uint64_t>>* WalletImpl::listCurrentStakes() c
std::vector<std::pair<std::string, uint64_t>>* stakes = new std::vector<std::pair<std::string, uint64_t>>;
auto response = wallet()->list_current_stakes();
auto main_addr = mainAddress();
for (rpc::GET_SERVICE_NODES::response::entry const &node_info : response)
{
for (const auto& node_info : response)
for (const auto& contributor : node_info.contributors)
{
stakes->push_back(std::make_pair(node_info.service_node_pubkey, contributor.amount));
}
}
if (contributor.address == main_addr)
stakes->push_back(std::make_pair(node_info.service_node_pubkey, contributor.amount));
return stakes;
}