SteemPlus 2.18 - Maximum available SP for delegation is inaccurate in busy

Project Information

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.

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

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

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)

GitHub Account

https://github.com/josephace135

GitHub Issue

In Issue 124, the project owner @steem-plus had fixed the bug.

H2
H3
H4
3 columns
2 columns
1 column
4 Comments