Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Commit

Permalink
Fix #533
Browse files Browse the repository at this point in the history
  • Loading branch information
maslenitsa93 committed Sep 14, 2018
1 parent b1a2603 commit d340841
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions libraries/chain/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1892,12 +1892,13 @@ namespace golos { namespace chain {
std::nth_element(
active.begin(), active.begin() + active.size() / 2, active.end(),
[&](const auto* a, const auto* b) {
return std::tie(a->props.*window, a->props.*items) <
std::tie(b->props.*window, b->props.*items);
return a->props.*window / a->props.*items <
b->props.*window / b->props.*items;
}
);
median_props.*window = active[active.size() / 2]->props.*window;
median_props.*items = active[active.size() / 2]->props.*items;
auto* median = active[active.size() / 2];
std::tie(median_props.*window, median_props.*items) =
std::tie(median->props.*window, median->props.*items);
};

calc_median(&chain_properties_17::account_creation_fee);
Expand Down
8 changes: 4 additions & 4 deletions libraries/chain/steem_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,8 @@ namespace golos { namespace chain {
} else {
GOLOS_CHECK_BANDWIDTH(current_capacity, consumption,
bandwidth_exception::comment_bandwidth,
"You may only comment ${cpw} times in ${cw} seconds.",
("cpw", mprops.comments_per_window)("cw", mprops.comments_window));
"You may only comment ${comments_per_window} times in ${comments_window} seconds.",
("comments_per_window", mprops.comments_per_window)("comments_window", mprops.comments_window));
}

db().modify(auth, [&](account_object &a) {
Expand Down Expand Up @@ -1245,8 +1245,8 @@ namespace golos { namespace chain {

GOLOS_CHECK_BANDWIDTH(current_capacity, consumption,
bandwidth_exception::vote_bandwidth,
"Can only vote ${vpw} times in ${vw} seconds.",
("cpw", mprops.votes_per_window)("cw", mprops.votes_window));
"Can only vote ${votes_per_window} times in ${votes_window} seconds.",
("votes_per_window", mprops.votes_per_window)("votes_window", mprops.votes_window));

_db.modify(voter, [&](account_object &a) {
a.voting_capacity = uint16_t(current_capacity - consumption);
Expand Down

0 comments on commit d340841

Please sign in to comment.