Skip to content

Commit

Permalink
Remove discussion rewards code steemit#805
Browse files Browse the repository at this point in the history
  • Loading branch information
theoreticalbts committed Jan 17, 2017
1 parent 97e221b commit d9a371c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 70 deletions.
64 changes: 1 addition & 63 deletions libraries/chain/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1897,56 +1897,6 @@ void database::adjust_total_payout( const comment_object& cur, const asset& sbd_
/// TODO: potentially modify author's total payout numbers as well
}

/**
* This method will iterate through all comment_vote_objects and give them
* (max_rewards * weight) / c.total_vote_weight.
*
* @returns unclaimed rewards.
*/
share_type database::pay_discussions( const comment_object& c, share_type max_rewards )
{
share_type unclaimed_rewards = max_rewards;
std::deque< comment_id_type > child_queue;

// TODO: Optimize in future hardfork

if( c.children_rshares2 > 0 )
{
const auto& comment_by_parent = get_index< comment_index >().indices().get< by_parent >();
fc::uint128_t total_rshares2( c.children_rshares2 - util::calculate_vshares( c.net_rshares.value ) );
child_queue.push_back( c.id );

// Pre-order traversal of the tree of child comments
while( child_queue.size() )
{
const auto& cur = get(child_queue.front());
child_queue.pop_front();

if( cur.net_rshares > 0 )
{
auto claim = static_cast< uint64_t >( ( util::to256( util::calculate_vshares( cur.net_rshares.value ) ) * max_rewards.value ) / util::to256( total_rshares2 ) );
unclaimed_rewards -= claim;

if( claim > 0 )
{
create_vesting( get_account( cur.author ), asset( claim, STEEM_SYMBOL ) );
// create discussion reward vop
}
}

auto itr = comment_by_parent.lower_bound( boost::make_tuple( cur.author, cur.permlink, comment_id_type() ) );

while( itr != comment_by_parent.end() && itr->parent_author == cur.author && itr->parent_permlink == cur.permlink )
{
child_queue.push_back( itr->id );
++itr;
}
}
}

return unclaimed_rewards;
}

/**
* This method will iterate through all comment_vote_objects and give them
* (max_rewards * weight) / c.total_vote_weight.
Expand Down Expand Up @@ -2034,18 +1984,11 @@ void database::cashout_comment_helper( const comment_object& comment )
asset total_payout;
if( reward_tokens > 0 )
{
share_type discussion_tokens = 0;
share_type curation_tokens = ( ( reward_tokens * get_curation_rewards_percent() ) / STEEMIT_100_PERCENT ).to_uint64();
if( comment.parent_author == STEEMIT_ROOT_POST_PARENT )
discussion_tokens = ( ( reward_tokens * get_discussion_rewards_percent() ) / STEEMIT_100_PERCENT ).to_uint64();

share_type author_tokens = reward_tokens.to_uint64() - discussion_tokens - curation_tokens;
share_type author_tokens = reward_tokens.to_uint64() - curation_tokens;

author_tokens += pay_curators( comment, curation_tokens );

if( discussion_tokens > 0 )
author_tokens += pay_discussions( comment, discussion_tokens );

auto sbd_steem = ( author_tokens * comment.percent_steem_dollars ) / ( 2 * STEEMIT_100_PERCENT ) ;
auto vesting_steem = author_tokens - sbd_steem;

Expand Down Expand Up @@ -2386,11 +2329,6 @@ void database::pay_liquidity_reward()
}
}

uint16_t database::get_discussion_rewards_percent() const
{
return 0;
}

uint16_t database::get_curation_rewards_percent() const
{
if( has_hardfork( STEEMIT_HARDFORK_0_8__116 ) )
Expand Down
2 changes: 0 additions & 2 deletions libraries/chain/include/steemit/chain/database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ namespace steemit { namespace chain {
*/
void clear_witness_votes( const account_object& a );
void process_vesting_withdrawals();
share_type pay_discussions( const comment_object& c, share_type max_rewards );
share_type pay_curators( const comment_object& c, share_type max_rewards );
void cashout_comment_helper( const comment_object& comment );
void process_comment_cashout();
Expand All @@ -333,7 +332,6 @@ namespace steemit { namespace chain {
asset get_curation_reward()const;
asset get_pow_reward()const;

uint16_t get_discussion_rewards_percent() const;
uint16_t get_curation_rewards_percent() const;

void pay_liquidity_reward();
Expand Down
5 changes: 0 additions & 5 deletions tests/tests/operation_time_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,6 @@ BOOST_FIXTURE_TEST_SUITE( operation_time_tests, clean_database_fixture )
FC_LOG_AND_RETHROW()
}*/

BOOST_AUTO_TEST_CASE( discussion_rewards )
{

}

/*
BOOST_AUTO_TEST_CASE( comment_payout )
{
Expand Down

0 comments on commit d9a371c

Please sign in to comment.