View Issue Details

IDProjectCategoryView StatusLast Update
0007492Talerwallet-corepublic2023-01-26 22:53
ReporterChristian Grothoff Assigned ToFlorian Dold  
PriorityurgentSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Platformi7OSDebian GNU/LinuxOS Versionsqueeze
Product Versiongit (master) 
Target Version0.9.1Fixed in Version0.9.1 
Summary0007492: wallet is still bad at arithmetic and looses money
DescriptionWe withdrew 0.0001 BTC.
Wallet receives 0.00099992 BTC after fees (OK, I guess).
I do a push payment over 0.00000002 BTC. No fees are shown. Usual fees are 1 satoshi, so this shouldn't cost much either.
New balance shows as 0.00099974. Given that the push payment shows as 2 satoshi cost, I had expected to see 99990 Satoshi.
I guess there MIGHT have been fees of 16 satoshi (deposit, refresh), but I had no prior indication that I'd have high fees here.

So either the fees are still not shown properly for p2p payments, or the wallet is still bad at math ;-).
TagsNo tags attached.

Activities

Windfisch

2022-12-19 02:48

reporter   ~0019515

The same happens when withdrawing 13.37 moneyz. The wallet tries to withdraw 13.36999999 instead. This smells like a floating point rounding error. For money, fix point arithmetics should be used instead.

Christian Grothoff

2022-12-19 09:17

manager   ~0019516

Last edited: 2022-12-19 09:27

The wallet never uses floating point, but it could be related to fees.

Christian Grothoff

2022-12-19 09:27

manager   ~0019517

Just analyzed this. Florian and I believe what happened is (simplified):
- imagine 4 satoshi are left to be withdrawn.
- wallet withdraws 2 satoshi with a 1 satoshi withdraw fee. The remaining satoshi CANNOT be withdrawn, as the withdraw fee is 1 satoshi.

The wallet could have
- withdrawn twice 1 satoshi paying 2 satoshi in withdraw fees. But the result would have been generally less useful, as each satoshi has a 1 satoshi deposit fee, so they are both worthless for merchants (and not more useful than the 2 satoshi piece, except for merchants that want a payment of 1 satoshi while covering the 1 satoshi deposit fee). So the wallet actually made the right choice here.

To avoid user confusion, we suggest that in the future a residual amount that is less than the withdraw fee plus coin value is hidden in the UX by adding this 'loss' to the fee that is being shown to the user.

Windfisch

2022-12-19 13:16

reporter   ~0019518

This happens not only for Bitcoin (never tried), but also for the KUDOS test setup on exchange.demo.taler.net, as well as my test setup on exchange.taler.windfis.ch (which will go down soon-ish).

Try selecting the exchange.demo.taler.net exchange and withdraw 13.37 KUDOS, you will get:

"Withdraw: 13.3 Kudos"

"Selected Amount: 13.36999999 KUDOS"

"Fees: -0.0699999 KUDOS"

Something very similar happens with 133.7 KUDOS

sebasjm

2022-12-19 19:05

developer   ~0019520

It would be nice to have a test case for that.

Windfisch, could you share the denomination configuration?
I could not reproduce your case on demo.taler.net, but seems complete logic.

Withdraw 13.3 KUDOS
Transaction fees -0.1 KUDOS
Total 13.2 KUDOS

Withdraw 13.37 KUDOS
Transaction fees -0.07 KUDOS
Total 13.30 KUDOS

Florian Dold

2022-12-20 10:08

manager   ~0019521

The wallet internally never uses floating point numbers, but always fixed-point arithmetic.

The issue must be either with the UI (i.e. conversion to float when rendering the amount) or come from the denomination configuration (and maybe some weird denomination selection done by the wallet).

@Windfish: As Sebastian said, the denomination configuration would be very helpful. Also, which wallet are you using?

Florian Dold

2023-01-13 02:16

manager   ~0019647

We now have a test for the withdrawal fees (taler-harness run-integrationtests withdrawal-fees).

Also, p2p push payments should now show the total cost properly to the initiator.

For p2p pull payments, we have 0007579 open.

Issue History

Date Modified Username Field Change
2022-11-23 11:22 Christian Grothoff New Issue
2022-11-23 11:22 Christian Grothoff Status new => assigned
2022-11-23 11:22 Christian Grothoff Assigned To => Florian Dold
2022-12-19 02:48 Windfisch Note Added: 0019515
2022-12-19 09:17 Christian Grothoff Note Added: 0019516
2022-12-19 09:27 Christian Grothoff Note Added: 0019517
2022-12-19 09:27 Christian Grothoff Note Edited: 0019516
2022-12-19 13:16 Windfisch Note Added: 0019518
2022-12-19 19:05 sebasjm Note Added: 0019520
2022-12-20 10:08 Florian Dold Note Added: 0019521
2023-01-13 02:16 Florian Dold Status assigned => resolved
2023-01-13 02:16 Florian Dold Resolution open => fixed
2023-01-13 02:16 Florian Dold Note Added: 0019647
2023-01-23 22:25 Christian Grothoff Fixed in Version => 0.9.1
2023-01-26 22:53 Christian Grothoff Status resolved => closed
2023-04-13 20:36 Florian Dold Category wallet (TS core) => wallet-core