Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid net_votes value returned by condenser_api.get_content #3234

Open
VIM-Arcange opened this issue Jan 21, 2019 · 1 comment
Open

Invalid net_votes value returned by condenser_api.get_content #3234

VIM-Arcange opened this issue Jan 21, 2019 · 1 comment

Comments

@VIM-Arcange
Copy link
Contributor

VIM-Arcange commented Jan 21, 2019

condenser_api.get_content return an invalid value for net_votes when there are "weight": 0 votes on a post/comment.

Here is an example:
author = 'conformity'
permlink = 'award-winning-cgi-3d-animated-short-film-le-gouffre-by-lightning-boy-studio-cgmeetup'

Calling get_content() returns:

{
  "id": 67448821,
  "author": "conformity",
  "permlink": "award-winning-cgi-3d-animated-short-film-le-gouffre-by-lightning-boy-studio-cgmeetup",
  ...
  "net_votes": -374,
   ...
}

If you check the "active_votes" array returned, you will notice there are exactly 374 upvotes with "weight": 0 value.

@oflyhigh
Copy link

oflyhigh commented Jan 25, 2019

This issue has existed since HF20.
And I think it may be caused by "Vote Dust Threshold" which be removed in HF20.
There are following codes in /libraries/chain/steem_evaluator.cpp

void hf20_vote_evaluator( const vote_operation& o, database& _db )`
{
....
      _db.modify( comment, [&]( comment_object& c )
      {
         c.net_rshares += rshares;
         c.abs_rshares += abs_rshares;
         if( rshares > 0 )
            c.vote_rshares += rshares;
         if( rshares > 0 )
            c.net_votes++;
         else
            c.net_votes--;
      });
...
}

There is not a issue before HF20, because before HF20 rshares is always greater than 0(upvote) or less than 0(downvote).

But after HF20, due to the removal of "Vote Dust Threshold", rshares can be zero.

   abs_rshares -= STEEM_VOTE_DUST_THRESHOLD;
   abs_rshares = std::max( int64_t(0), abs_rshares );

so right codes should be:

         if( rshares > 0 )
            c.net_votes++;
         else if ( rshares < 0 )
            c.net_votes--;

😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants