dashed-slug.net › Forums › General discussion › Witdrawal Issue Invalid Amount Status 500
- This topic has 10 replies, 2 voices, and was last updated 6 years, 4 months ago by
alexg.
-
AuthorPosts
-
February 5, 2019 at 8:09 am #5782
alexg
KeymasterI 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 #5784megeanwasson
ParticipantThanks Alex,
I will test and let you know asap 🙂February 5, 2019 at 9:37 am #5785megeanwasson
ParticipantWould 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 #5786megeanwasson
ParticipantHi 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 #5787megeanwasson
ParticipantHi 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 #5788alexg
KeymasterHmm. 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 #5789megeanwasson
ParticipantAll 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 #5790megeanwasson
ParticipantOk 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 #5791alexg
KeymasterThank 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 #5798alexg
KeymasterVersion
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.