-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Paying through RPC/CLI could be 1 sat lower than the actual payment amount. #8274
Comments
I cannot reproduce this. |
rather than using round, I would suggest this: index d7e1af79e..965cefed3 100644
--- a/electrum/commands.py
+++ b/electrum/commands.py
@@ -1456,7 +1456,7 @@ command_options = {
# don't use floats because of rounding errors
from .transaction import convert_raw_tx_to_hex
-json_loads = lambda x: json.loads(x, parse_float=lambda x: str(Decimal(x)))
+json_loads = lambda x: json.loads(x, parse_float=lambda x: str(Decimal(str(x))))
arg_types = {
'num': int,
'nbits': int,
but again, I cannot reproduce your issue |
I suggest amounts to be strings already on the caller side.
Just set |
I can reproduce via jsonrpc. It does not happen via the CLI.
@ecdsa is right, we should try to reuse: electrum/electrum/exchange_rate.py Lines 43 to 51 in 0d007b5
|
Thanks for reporting this. Should be fixed on master now. I still suggest using string amounts though :P (which you can also do on the latest release to work around this issue) |
@ecdsa @SomberNight |
we are targeting next week for a release |
For example if we set ["address", 0.00033389] in the params of paytomany method. It always results in 0.00033388 btc in transaction. Through investigation, looks like it is caused by type casting from Decimal to Int in satoshis function. (https://github.com/spesmilo/electrum/blob/master/electrum/commands.py#L86)
![image](https://user-images.githubusercontent.com/51077262/226845736-effd0f75-80c8-4cd4-9d68-7852b948cdb6.png)
Test shows that rounding the amount before type casting can solve this issue. Could we please add a fix for it?The text was updated successfully, but these errors were encountered: