Open extra topbar

Witdrawal Issue Invalid Amount Status 500

If you are new here, please see some information on how to ask for support. Thank you!

Witdrawal Issue Invalid Amount Status 500

dashed-slug.net Forums General discussion Witdrawal Issue Invalid Amount Status 500

This topic contains 10 replies, has 2 voices, and was last updated by  alexg 8 months, 2 weeks ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #5779

    megeanwasson
    Participant

    Hi Alex,
    I am having trouble withdrawing BTC and cannot find where the problem is, any assistance/help will be appreciated.
    In wallet settings TX fees are 0 for everything.
    Tried with and with out fees, also tried with fees set in the coin wallet conf.

    I get the same error with other coins if they have fees, but they seem to work ok without fees except BTC.

    My admin Error Log Showing:
    User ‘XXXXXXX’ failed to withdraw ‘0.005469100000000000176558767606138644623570144176483154296875 BTC’ to address ‘XXXXXXXXXXXXXXXXXXXXXXXX’

    Email sent to user on failure:
    You have attempted to withdraw āļŋ0.00546910 to address XXXXXXXXXXXXXXXXXXXXXXXXX.
    Your transaction failed after being attempted a predetermined number of times and will not be retried any further.
    If you are unsure why your transaction failed, please contact the administrator.
    Coin symbol: BTC
    Last error message: Dashed_Slug_Wallets_Coin_Adapter_RPC->do_withdraw() failed to send with status=”500″ and error=”Invalid amount”
    Transaction created at: 2019-02-05 07:39:28

    I can follow any steps you recommend to try pinpoint the error.

    Kind Regards
    Megan

    #5782

    alexg
    Keymaster

    I am somewhat surprised that there are so many decimals in the amount, but it is possible that there is a rounding error that’s causing this.

    The relevant code is here: https://github.com/dashed-slug/wallets/blob/4.0.2/includes/coin-adapter-rpc.php#L441-L448

    Could you try without the floatval() function? i.e. edit the code to be:

    
    			$amount = number_format( (float) $amount, 8, '.', '' );
    			$result = $this->rpc->sendtoaddress(
    				"$address",
    				$amount,
    				"$comment",
    				"$comment_to"
    			);
    

    Then retry your withdrawal.

    If this works I’ll have to patch that line in the next release.

    thanks!

    #5784

    megeanwasson
    Participant

    Thanks Alex,
    I will test and let you know asap 🙂

    #5785

    megeanwasson
    Participant

    Would this also affect the deposits?

    User ‘XXXXXXX’ deposited ‘194.258284550000013268800103105604648590087890625 OASIS’ with transaction ‘XXXXXXXXXXXXXXXXXXXXXXXXXXXXX’.

    Also showing all those decimals on deposits.

    I am busy loading your suggested patch and will be testing in the next few minutes 🙂

    #5786

    megeanwasson
    Participant

    Hi Alex,
    The patch has worked, I was able to successfully withdraw BTC and it gave the correct decimals 🙂
    Deposits decimals also look correct now with 8 places 🙂
    Thank you yet again 🙂

    #5787

    megeanwasson
    Participant

    Hi Alex,
    Apologies, this fix only worked for BTC withdrawal, some of the other coins now give a different error.

    If you are unsure why your transaction failed, please contact the administrator.
    Coin symbol: OASIS
    Last error message: Dashed_Slug_Wallets_Coin_Adapter_RPC->do_withdraw() failed to send with status=”500″ and error=”value is type str, expected real”
    Transaction created at: 2019-02-05 18:52:21

    Regards
    Morne

    #5788

    alexg
    Keymaster

    Hmm. That’s interesting.

    The problem is that these errors are somewhat hard to reproduce. All this time I’ve been developing the plugin, I’ve never come across this error, and I’ve been testing withdrawals in almost every release. It’s possible that only certain numbers cause this error. Also, I don’t know about OASIS.

    In any case, it seems we have the following requirements:

    1. Not too many digits
    2. Must be a float, not string

    Therefore the solution is the PHP round function. Is it possible for you to test OASIS again with this? My tests indicate that Bitcoin core accepts it.

    
    			$amount = round( $amount, 8 );
    
    			$result = $this->rpc->sendtoaddress(
    				"$address",
    				$amount,
    				"$comment",
    				"$comment_to"
    			);
    

    It should work with both wallets.

    #5789

    megeanwasson
    Participant

    All the coins I use are bitcoin type forks, oasis is a DASH fork.
    Will try this new patch again now and let you know.

    #5790

    megeanwasson
    Participant

    Ok that worked for OASIS now, will do a test on all the other coins including BTC again and let you know the reulst.

    #5791

    alexg
    Keymaster

    Thank you.

    It is extremely unlikely that there will be any more problems with this.

    I will release the patch now, as several bug fixes have accumulated since 4.0.2

    kind regards

    #5798

    alexg
    Keymaster

    Version 4.0.3 is out with this fix. The withdrawal amounts sent over JSON-RPC APIs to wallets are now floats with 8 decimals.

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.