Can not remove upvotes from own post.
I've now tried several times to remove my own upvote from my own post and here's the error I now get. This issue just started today to the best of my knowledge. This has happened several times today on several different posts of mine where I forgot to uncheck the auto self-upvote box.
Transaction failed: abs_rshares > 30000000: voting weight is too small, please accumulate more voting power or steem power
I know this isn't a lack of voting power because I had over 98%+ of my voting power both times I tried to remove my own accidental upvotes.
I don't think above commit fixed the issue. abs_rshares is not 1 in most cases when voting_weight is 0. Why not just check if o.weight == 0?
Just a couple lines previous...
if( abs_rshares == 0 ) abs_rshares = 1;
It is there to prevent a divide by zero other places. Decided it was best to have the assert only deal with abs_rshares rather than add in another variable.
@mvandeberg you didn't get it.
When unvoting, abs_weight == 0,
thus used_power = (current_power * abs_weight / STEEMIT_100_PERCENT) / 200 + 1 = 1,
thus abs_rshares = voter.vesting_shares.amount.value * used_power / STEEMIT_100_PERCENT should > 1 when vesting_shares.amount is more than 2 * STEEMIT_100_PERCENT aka 20,000, which is true in most cases.
#132 is related
Here is my suggestion for how to fix this problem:
Replace this line with:
used_power = (used_power/200);
if( !db().has_hardfork( STEEMIT_HARDFORK_0_13__259 ) )
used_power += 1;
Replace this line with:
if( !db().has_hardfork( STEEMIT_HARDFORK_0_13__259 ) && abs_rshares == 0 ) abs_rshares = 1;
Replace this line with:
FC_ASSERT( abs_rshares > 50000000 || o.weight == 0, "voting weight is too small, please accumulate more voting power or steem power" );
And replace this line with:
auto avg_cashout_sec;
if( db().has_hardfork( STEEMIT_HARDFORK_0_13__259 ) && abs_rshares == 0 )
avg_cashout_sec = cur_cashout_time_sec;
else
avg_cashout_sec = (cur_cashout_time_sec * old_root_abs_rshares + new_cashout_time_sec * abs_rshares ) / ( old_root_abs_rshares + abs_rshares );
And of course you would define STEEMIT_HARDFORK_0_13__259 to be STEEMIT_HARDFORK_0_13 in 0_13.hf.
I hope these changes (or something like it) is included into hardfork 13, so that users can unvote without having to wait until hardfork 14.
@arhag
That would work and would fix the concerns about possible divide by zero problems though they would likely never arise. Regardless it never hurts to play it safe and a push to hf 13 would be much appreciated because it's a simple bug fix that could easily be remedied before the hf 13 rollout in a couple days.
Pull request submitted (#270), please review.
OK, now hard fork 13 is in effect. My patch can't be merged as is. It's up to the devs to decide how to deal with this issue.
I'll update the merge to work with the next hardfork
The first change suggested by @arhag -- effectively replacing used_power = (used_power/200)+1 with used_power = used_power/200 -- will keep an account from ever being able to drain its voting power to zero; effectively once your voting power is 199, you can no longer vote. The reason for the +1 was to allow voting power to be drained to zero.
- (a) The thing we need to do to prevent the problem in this ticket is to make sure that the result of this operation is zero when the input is zero.
- (b) The thing we need to do to prevent the problem of being unable to vote despite having nonzero voting power is to make sure that the result of this operation is nonzero when the input is nonzero.
The existing code satisfies (b) but not (a); @arhag's solution satisfies (a) but not (b); I propose to divide and round up, which satisfies both (a) and (b).
used_power = (used_power+199) / 200
@theoreticalbts please check #132 as well.
Thanks, I think that ticket can be closed as well.
This line of code change brought forks.
1128420ms th_a application.cpp:463 handle_block ] Error when pushing block:
10 assert_exception: Assert Exception
abs_rshares > 50000000 || abs_rshares == 1: voting weight is too small, please accumulate more voting power or steem power
{}
th_a steem_evaluator.cpp:889 do_apply
{"o":{"voter":"snowdon59","author":"snowdon59","permlink":"as-the-father-has-loved-me","weight":0}}
th_a steem_evaluator.cpp:1146 do_apply
{"op":["vote",{"voter":"snowdon59","author":"snowdon59","permlink":"as-the-father-has-loved-me","weight":0}]}
th_a database.cpp:2862 _apply_transaction
{"trx":{"ref_block_num":47003,"ref_block_prefix":2765451144,"expiration":"2016-09-09T22:18:57","operations":[["vote",{"voter":"sno
wdon59","author":"snowdon59","permlink":"as-the-father-has-loved-me","weight":0}]],"extensions":[],"signatures":["20421625ef51d7829b3a
393eef21951ed2442642d3fc778cd27b8c3ae8c026df896ca3d0db8cf0e3554d227c248994064bbd716269347cf4f3043fe16c77ea2913"]}}
th_a database.cpp:2866 _apply_transaction
rethrow
{}
th_a database.cpp:2686 _apply_block
{"new_block":{"previous":"0049b79fd8703f0d95705d2eec3bd96416e0171a","timestamp":"2016-09-09T22:18:48","witness":"wackou",...
Proposed fix in this commit: https://github.com/steemit/steem/commit/e6f860847de82ff70b96cefacfe2712198076a5c, please review.