Skip to content

Commit

Permalink
Maybe the demon is truly gone now?
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat committed Jul 20, 2020
1 parent 22962b8 commit 1fda634
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ struct vote_state
uint64_t weight = 0;
int64_t rshares = 0;
int16_t percent = 0;
share_type reputation = 0;
time_point_sec time;
};

Expand All @@ -62,7 +61,6 @@ struct discussion : public database_api::api_comment_object
asset total_pending_payout_value; ///< BLURT_SYMBOL including replies
vector< vote_state > active_votes;
vector< string > replies; ///< author/slug mapping
share_type author_reputation = 0;
asset promoted = asset(0, BLURT_SYMBOL);
uint32_t body_length = 0;
vector< account_name_type > reblogged_by;
Expand Down Expand Up @@ -242,10 +240,10 @@ FC_REFLECT( blurt::plugins::tags::api_tag_object,
(name)(total_payouts)(net_votes)(top_posts)(comments)(trending) )

FC_REFLECT( blurt::plugins::tags::vote_state,
(voter)(weight)(rshares)(percent)(reputation)(time) )
(voter)(weight)(rshares)(percent)(time) )

FC_REFLECT_DERIVED( blurt::plugins::tags::discussion, (blurt::plugins::database_api::api_comment_object),
(url)(root_title)(pending_payout_value)(total_pending_payout_value)(active_votes)(replies)(author_reputation)(promoted)(body_length)(reblogged_by)(first_reblogged_by)(first_reblogged_on) )
(url)(root_title)(pending_payout_value)(total_pending_payout_value)(active_votes)(replies)(promoted)(body_length)(reblogged_by)(first_reblogged_by)(first_reblogged_on) )

FC_REFLECT( blurt::plugins::tags::get_trending_tags_args,
(start_tag)(limit) )
Expand Down
13 changes: 0 additions & 13 deletions libraries/plugins/apis/tags_api/tags_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,14 +520,6 @@ DEFINE_API_IMPL( tags_api_impl, get_active_votes )
vstate.rshares = itr->rshares;
vstate.percent = itr->vote_percent;
vstate.time = itr->last_update;

if( _follow_api )
{
auto reps = _follow_api->get_account_reputations( follow::get_account_reputations_args( { vo.name, 1 } ) ).reputations;
if( reps.size() )
vstate.reputation = reps[0].reputation;
}

result.votes.push_back( vstate );
++itr;
}
Expand Down Expand Up @@ -556,11 +548,6 @@ void tags_api_impl::set_pending_payout( discussion& d )
r2 /= total_r2;

d.pending_payout_value = asset( static_cast<uint64_t>(r2), pot.symbol );

if( _follow_api )
{
d.author_reputation = _follow_api->get_account_reputations( follow::get_account_reputations_args( { d.author, 1} ) ).reputations[0].reputation;
}
}

if( d.parent_author != BLURT_ROOT_POST_PARENT )
Expand Down
31 changes: 0 additions & 31 deletions libraries/plugins/follow/follow_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,36 +283,6 @@ struct post_operation_visitor
const auto& cv_idx = db.get_index< comment_vote_index >().indices().get< by_comment_voter >();
auto cv = cv_idx.find( boost::make_tuple( comment.id, db.get_account( op.voter ).id ) );

const auto& rep_idx = db.get_index< reputation_index >().indices().get< by_account >();
auto voter_rep = rep_idx.find( op.voter );
auto author_rep = rep_idx.find( op.author );

// Rules are a plugin, do not effect consensus, and are subject to change.
// Rule #1: Must have non-negative reputation to effect another user's reputation
if( voter_rep != rep_idx.end() && voter_rep->reputation < 0 ) return;

if( author_rep == rep_idx.end() )
{
// Rule #2: If you are down voting another user, you must have more reputation than them to impact their reputation
// User rep is 0, so requires voter having positive rep
if( cv->rshares < 0 && !( voter_rep != rep_idx.end() && voter_rep->reputation > 0 )) return;

db.create< reputation_object >( [&]( reputation_object& r )
{
r.account = op.author;
r.reputation = ( cv->rshares >> 6 ); // Shift away precision from vests. It is noise
});
}
else
{
// Rule #2: If you are down voting another user, you must have more reputation than them to impact their reputation
if( cv->rshares < 0 && !( voter_rep != rep_idx.end() && voter_rep->reputation > author_rep->reputation ) ) return;

db.modify( *author_rep, [&]( reputation_object& r )
{
r.reputation += ( cv->rshares >> 6 ); // Shift away precision from vests. It is noise
});
}
}
FC_CAPTURE_AND_RETHROW()
}
Expand Down Expand Up @@ -382,7 +352,6 @@ void follow_plugin::plugin_initialize( const boost::program_options::variables_m
BLURT_ADD_PLUGIN_INDEX(my->_db, follow_index);
BLURT_ADD_PLUGIN_INDEX(my->_db, feed_index);
BLURT_ADD_PLUGIN_INDEX(my->_db, blog_index);
BLURT_ADD_PLUGIN_INDEX(my->_db, reputation_index);
BLURT_ADD_PLUGIN_INDEX(my->_db, follow_count_index);
BLURT_ADD_PLUGIN_INDEX(my->_db, blog_author_stats_index);

Expand Down
2 changes: 0 additions & 2 deletions libraries/wallet/include/blurt/wallet/remote_node_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ struct remote_node_api
vector< follow::comment_feed_entry > get_feed( account_name_type, uint32_t, uint32_t );
vector< follow::blog_entry > get_blog_entries( account_name_type, uint32_t, uint32_t );
vector< follow::comment_blog_entry > get_blog( account_name_type, uint32_t, uint32_t );
vector< follow::account_reputation > get_account_reputations( account_name_type, uint32_t );
vector< account_name_type > get_reblogged_by( account_name_type, string );
vector< follow::reblog_count > get_blog_authors( account_name_type );
vector< condenser_api::api_proposal_object > list_proposals( fc::variant, uint32_t, database_api::sort_order_type, database_api::order_direction_type, database_api::proposal_status );
Expand Down Expand Up @@ -174,7 +173,6 @@ FC_API( blurt::wallet::remote_node_api,
(get_feed)
(get_blog_entries)
(get_blog)
(get_account_reputations)
(get_reblogged_by)
(get_blog_authors)
(list_proposals)
Expand Down
13 changes: 0 additions & 13 deletions tests/scripts/api_error_smoketest.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,6 @@
"method": "condenser_api.get_blog",
"params": ["temp", -1, 10]
},
{
"method": "condenser_api.get_account_reputations",
"params": ["", 10]
},
# Might be broken
# {
# "method": "condenser_api.get_reblogged_by",
Expand Down Expand Up @@ -348,10 +344,6 @@
"method": "follow_api.get_blog",
"params": {"account":"temp", "start":-1, "limit":10}
},
{
"method": "follow_api.get_account_reputations",
"params": {"lower_bound":"", "limit":10}
},
# Might be broken
# {
# "method": "condenser_api.get_reblogged_by",
Expand All @@ -373,11 +365,6 @@
"method": "rc_api.find_rc_accounts",
"params": {"accounts":["test"]}
},
# Not currently enabled
# {
# "method": "reputation_api.get_account_reputations",
# "params": {"lower_bound":"", "limit":10}
# },
{
"method": "tags_api.get_trending_tags",
"params": {"start_tag":"", "limit":20}
Expand Down

0 comments on commit 1fda634

Please sign in to comment.