Skip to content

test: Convert amounts in testmempoolaccept test from float to decimal #20011

Closed

Description

@maflcko

Float should not be used for currency amounts (not even in tests). Thus float should be converted to use decimal. See also #19940 (review)

Useful skills:

Python 3

Want to work on this issue?

For guidance on contributing, please read CONTRIBUTING.md before opening your pull request.

Activity

  1. hmrawal commented on Sep 26, 2020

    @hmrawal

    I would like to do this one as this will be my first contribution. I see the status as open but the code already has Decimal implemented. Could you please update on this ?

  2. n-moria12 commented on Sep 29, 2020

    @n-moria12

    import decimal
    assert_equal(from_balance_before - from_wallet.getbalance(), decimal.Decimal(amount))

    is this correct?

  3. maflcko commented on Sep 29, 2020

    @maflcko
    MemberAuthor

    Converting a float to decimal where it is used doesn't help. It needs to be converted where it is defined, so that all calculations are done as decimal

  4. n-moria12 commented on Sep 29, 2020

    @n-moria12

    okay

  5. locked as resolved and limited conversation to collaborators on Feb 15, 2022
  6. added a commit that references this issue on Nov 7, 2022
  7. added a commit that references this issue on Jul 21, 2023
  8. added a commit that references this issue on Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions