dashed-slug.net › Forums › General discussion › Witdrawal Issue Invalid Amount Status 500
- This topic has 10 replies, 2 voices, and was last updated 5 years, 10 months ago by alexg.
-
AuthorPosts
-
February 5, 2019 at 7:58 am #5779megeanwassonParticipant
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:28I can follow any steps you recommend to try pinpoint the error.
Kind Regards
MeganFebruary 5, 2019 at 8:09 am #5782alexgKeymasterI 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!
February 5, 2019 at 9:22 am #5784megeanwassonParticipantThanks Alex,
I will test and let you know asap ðFebruary 5, 2019 at 9:37 am #5785megeanwassonParticipantWould 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 ð
February 5, 2019 at 10:15 am #5786megeanwassonParticipantHi 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 ðFebruary 5, 2019 at 4:50 pm #5787megeanwassonParticipantHi 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:21Regards
MorneFebruary 5, 2019 at 5:14 pm #5788alexgKeymasterHmm. 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 stringTherefore 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.
February 5, 2019 at 5:32 pm #5789megeanwassonParticipantAll the coins I use are bitcoin type forks, oasis is a DASH fork.
Will try this new patch again now and let you know.February 5, 2019 at 5:35 pm #5790megeanwassonParticipantOk that worked for OASIS now, will do a test on all the other coins including BTC again and let you know the reulst.
February 5, 2019 at 5:37 pm #5791alexgKeymasterThank 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
February 5, 2019 at 5:53 pm #5798alexgKeymasterVersion
4.0.3
is out with this fix. The withdrawal amounts sent over JSON-RPC APIs to wallets are now floats with 8 decimals. -
AuthorPosts
- You must be logged in to reply to this topic.