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

Commit

Permalink
Merge pull request #1344 from GolosChain/1014-curator-penalty-payout
Browse files Browse the repository at this point in the history
Do not promote author by auction curator payout #1014
  • Loading branch information
afalaleev authored Jul 5, 2019
2 parents e3ea9b2 + 9cb8125 commit 04ce6b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
21 changes: 7 additions & 14 deletions libraries/chain/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2331,18 +2331,9 @@ namespace golos { namespace chain {
return delegators_reward;
}

uint64_t database::pay_curator(const comment_vote_object& cvo, uint64_t claim, const account_name_type& author, const std::string& permlink) {
void database::pay_curator(const comment_vote_object& cvo, uint64_t claim, const account_name_type& author, const std::string& permlink) {
const auto &voter = get(cvo.voter);

uint64_t to_author = 0;
if (has_hardfork(STEEMIT_HARDFORK_0_21__1014)) {
to_author = (uint128_t(claim) * cvo.author_promote_rate / STEEMIT_100_PERCENT).to_uint64();
claim -= to_author;
if (claim == 0) {
return to_author;
}
}

if (has_hardfork(STEEMIT_HARDFORK_0_19__756)) {
claim -= pay_delegators(voter, cvo, claim);
}
Expand All @@ -2354,8 +2345,6 @@ namespace golos { namespace chain {
modify(voter, [&](account_object &a) {
a.curation_rewards += claim;
});

return to_author;
}
/**
* This method will iterate through all comment_vote_objects and give them
Expand Down Expand Up @@ -2393,8 +2382,11 @@ namespace golos { namespace chain {
}

if (claim > 0) { // min_amt is non-zero satoshis
if (has_hardfork(STEEMIT_HARDFORK_0_21__1014)) {
claim -= (uint128_t(claim) * (*itr->vote).author_promote_rate / STEEMIT_100_PERCENT).to_uint64();
}
unclaimed_rewards -= claim;
unclaimed_rewards += pay_curator(*itr->vote, claim, c.comment.author, to_string(c.comment.permlink));
pay_curator(*itr->vote, claim, c.comment.author, to_string(c.comment.permlink));
} else {
break;
}
Expand All @@ -2403,7 +2395,8 @@ namespace golos { namespace chain {
// pay needed claim + rest unclaimed tokens (close to zero value) to curator with greates weight
// BTW: it has to be unclaimed_rewards.value not heaviest_vote_after_auw_weight + unclaimed_rewards.value, coz
// unclaimed_rewards already contains this.
unclaimed_rewards = pay_curator(*heaviest_itr->vote, unclaimed_rewards.value, c.comment.author, to_string(c.comment.permlink));
pay_curator(*heaviest_itr->vote, unclaimed_rewards.value, c.comment.author, to_string(c.comment.permlink));
unclaimed_rewards = 0;
}
}
if (!c.comment.allow_curation_rewards) {
Expand Down
2 changes: 1 addition & 1 deletion libraries/chain/include/golos/chain/database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ namespace golos { namespace chain {

bool _resize(uint32_t block_num);

uint64_t pay_curator(const comment_vote_object& cvo, uint64_t claim, const account_name_type& author, const std::string& permlink);
void pay_curator(const comment_vote_object& cvo, uint64_t claim, const account_name_type& author, const std::string& permlink);

void adjust_sbd_balance(const account_object &a, const asset &delta);

Expand Down

0 comments on commit 04ce6b7

Please sign in to comment.