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

Maximum available SP for delegation is inaccurate in busy #124

Closed
josephace135 opened this issue Jul 12, 2018 · 1 comment
Closed

Maximum available SP for delegation is inaccurate in busy #124

josephace135 opened this issue Jul 12, 2018 · 1 comment

Comments

@josephace135
Copy link

josephace135 commented Jul 12, 2018

Expected behavior

When a delegator delegates parts of his SP to an account, the maximum available SP for delegation should be presented as the difference of his total SP minus his total delegated SP minus 5.000.

Actual behavior

When pressing the "Delegate" button in busy, the maximum available SP for delegation is incorrect wherein it is expressed in this formula: Max available SP = Total SP of the Delegator - Total delegated SP/Outgoing delegation of the account to be delegated - 5.000. With that formula, there are three possible scenarios that would occur which are as follows:

  • Max available SP = Total SP of the delegator - 5.000, if the account to be delegated doesn't have an outgoing delegation.
  • Max available SP > 0, if the outgoing delegation of the account to be delegated is less than the delegator's Total SP.
  • Max available SP = 0, if the outgoing delegation of the account to be delegated is greater than the delegator's total SP.

How to reproduce

  • Go to busy.org and make sure that SteemPlus plug-in is switched for use in busy.org.
  • Go to the profile of the account you want to delegate SP.
  • Click the Wallet of that account.
  • Click the Delegate button.
  • The bug would appear for which the maximum available SP for delegation is incorrect.

Recording Of The Bug

In these three recordings, I am the delegator with a Total SP of 715.014 and my total delegated SP of 450.794 is not considered in the computation.

  • Max Available SP = Total SP of the delegator - 5.000
    Account to be delegated @mightypanda (for example), and doesn't have any outgoing delegation.

https://youtu.be/OHOAxnogT2A

  • Max available SP > 0
    Account to be delegated @stoodkev (for example), with a total delegated SP of 604.860

https://youtu.be/Y5N4wiEb6vs

  • Max available SP = 0
    Account to be delegated: @utopian-io (for example), with a total delegated SP = 3276.120

https://youtu.be/Cz44DxC6nCk

Environment

  • Browser version: Chromium Version 58.0.2988.0
  • App/Plugin version: SteemPlus 2.18
  • Device: HP Notebook
  • Operating system: Windows 10 64-bit

Issue

In delegate.js, the codes in 137-140, the formula for obtaining the maximum available SP that the user can delegate is shown.

      function getMaxSP(){
        var myVests = parseFloat(steem.formatter.vestToSteem(myAccountDelegation.vesting_shares.replace(' VESTS',''), globalP.totalVests, globalP.totalSteem) * 100) / 100;
        var maxSP = myVests - totalOutgoingDelegation - 5.000;

        return (maxSP > 0 ? maxSP.toFixed(3) : 0);
      }

With that, the amount for totalOutgoingDelegation is obtained from the account to be delegated instead of the delegator. Perhaps, the issue is found in the codes in line 88,

if(totalOutgoingDelegation===-1&&(regexWalletBusy.test(window.location.href)||regexWalletSteemit.test(window.location.href))&&retryCountDelegate<20)

@steemplus
Copy link
Contributor

Fixed

steemplus added a commit to steemplus/SteemPlus that referenced this issue Jul 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants