synonymdev / bitkit

Self-custodial Bitcoin and Lightning Wallet for Android and iOS.
https://bitkit.to
MIT License
116 stars 22 forks source link

[Bug]: Receive Instantly btc/usd toggle can cause the displayed invoice amount to change due to conversion #1606

Open catch-21 opened 8 months ago

catch-21 commented 8 months ago

Describe the bug

This is a minor UI inconsistency with the expected btc/usd conversion (the smaller value in grey above the input invoice amount) and the displayed input value after toggling between the two denomination.

In the attached screengrab video, the expected conversion from 20000 sats is $14.50 but $14.49 is displayed after toggling unit. Then, even though the displayed input value is lower than minimum, after pressing 'Continue' it displays $14.50 again. When inputting dollar value $14.49 the expected is 19993 sats.

I suspect this is due to rounding on conversion and will probably occur whilst there is no sat/cent parity, but the the btc/dollar conversion should at least be consistent across all views in a given invoice.

Reproduce

  1. Go to 'Receive Instantly'
  2. Input the minimum sat value (20_000)
  3. Toggle to view USD
  4. Observe input value is $14.49 instead of the expected $14.50
  5. It is possible to tap 'Continue' even though the input value is 1 cent lower than the minimum dollar value.

Screenshots / Recording

https://github.com/synonymdev/bitkit/assets/74595920/97a65499-637e-4f4f-8ee9-c33f4827e7e0

Operating system

Android 13 TKQ1.220829.002

Bitkit version

d04af4786fabe20468469a63f76e8c521dea15c1

Log output

No response

catch-21 commented 6 months ago

Tested on 898a58a42979ef8bee906b10182c8a12399e1d16 Still occurring, this is a minor bug still.

https://github.com/synonymdev/bitkit/assets/74595920/9c401201-1331-47e4-8d72-7eedabdffd0a