Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

fix: decimal precision issue with balance shell command #80

Merged
merged 5 commits into from
Apr 15, 2022

Conversation

mvadari
Copy link
Contributor

@mvadari mvadari commented Apr 14, 2022

High Level Overview of Change

The precision was incorrect for the balance of the accounts in the balance output. This PR fixes that precision issue. It would also be resolved by astanin/python-tabulate#176, but that will take longer to be approved.

Context of Change

Reported by @sgramkumar

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Before / After

Before:

SSX> balance
 account   |               balance | currency   | peer   | limit
-----------+-----------------------+------------+--------+---------
 main root | 99,999,998,999.999985 | XRP        |        |
 main door |            999.999940 | XRP        |        |
 side door | 99,999,999,999.999954 | XRP        |        |

After:

SSX> balance
 account   |               balance | currency   | peer   | limit
-----------+-----------------------+------------+--------+---------
 main root | 99,999,998,999.999980 | XRP        |        |
 main door |            999.999940 | XRP        |        |
 side door | 99,999,999,999.999950 | XRP        |        |

Test Plan

Tested manually, it works properly.

@mvadari mvadari changed the title fix: fix: decimal precision issue with balance shell command Apr 14, 2022
@mvadari mvadari requested a review from sgramkumar April 14, 2022 20:35
@mvadari mvadari marked this pull request as ready for review April 14, 2022 22:43
Copy link

@sgramkumar sgramkumar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good.

Works as expected.

SSX> balance
 account    |               balance | currency   | peer   | limit
------------+-----------------------+------------+--------+---------
 main root  | 99,999,993,999.999970 | XRP        |        |
 main door  |          2,000.000040 | XRP        |        |
 main alice |          3,999.999780 | XRP        |        |
 side door  | 99,999,998,999.999750 | XRP        |        |
 side bob   |          1,000.000000 | XRP        |        |
SSX> account_info
 account    |           balance |   flags |   owner_count | previous_txn_id                                                  |   previous_txn_lgr_seq |   sequence |   TicketCount
------------+-------------------+---------+---------------+------------------------------------------------------------------+------------------------+------------+---------------
 main root  | 99999993999999970 | 8388608 |             0 | 28C647B506252CCD02DD5448F6AF245D33D8DC6D4D758489B3341C6449720E97 |                     27 |          4 |
 main door  |        2000000040 | 1048576 |             5 | 1349E56F227FD2E3AAC11E376910CC2A0DD985F1EE4F4EC46A87582EE1740A09 |                     47 |         14 |             3
 main alice |        3999999780 |       0 |             0 | 1349E56F227FD2E3AAC11E376910CC2A0DD985F1EE4F4EC46A87582EE1740A09 |                     47 |         29 |
 side door  | 99999998999999750 | 1048576 |             4 | B3F723C22069AC29E6332C3F216478E72538BC200D76C6F90F5C008C2880CDD8 |                     53 |         11 |             3
 side bob   |        1000000000 |       0 |             0 | B3F723C22069AC29E6332C3F216478E72538BC200D76C6F90F5C008C2880CDD8 |                     53 |         53 |
SSX> 

@mvadari mvadari merged commit a31b77a into main Apr 15, 2022
@mvadari mvadari deleted the drop-discrepancy branch April 15, 2022 16:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants