adityapk00 / zecwallet-lite

Zecwallet-Lite is z-Addr first lightwallet for Zcash.
MIT License
106 stars 83 forks source link

Transaction detail view shows incorrect values for amount and transaction fee #114

Open bobanm opened 3 years ago

bobanm commented 3 years ago

Describe the bug

I used Android app to transfer 0.1 ZEC using a shielding transaction from a t-address to z-address. Both addresses are managed by my wallet. The transaction completed successfully, but the transaction summary view messed up some values. Please take a look at the screenshot:

Screenshot_20210811-153729m

  1. The value on top that should show amount of 0.1 ZEC, shows what it seems to be transaction fee instead
  2. The Amount field below is correct.
  3. The Tx Fee field shows negative value, which should be equal to the value transferred to my z-address after the fee has been deducted
  4. The transaction list view in Wallet tab only shows the outbound transaction from t-address, but not the inbound transaction to z-address

This seems to be an issue with how Zecwallet renders data, as the same transaction shows the correct amount and fee on a block explorer.

To Reproduce

  1. Open Zecwallet Lite on Android
  2. Go to Send tab
  3. Enter the z-address managed by your wallet
  4. Enter amount you have associated with your t-address
  5. Select Send
  6. Open transaction details from Wallet tab

Expected behavior

  1. The top section of the outbound transaction detail view should show "Sent ZEC -0.1"
  2. The Tx Fee field should show "0.00001"
  3. The list on the wallet tab should also include additional entry with the inbound transaction to my z-address

Additional context

There is a discrepancy on how Android app and desktop app show amounts in the transaction list view. When I go back to the transaction list view [Wallet tab] on Android, that outbound transaction has "-0.00001" as the amount. But when I open the desktop wallet [which uses the same seed as my mobile wallet] there the Transactions section correctly shows "ZEC 0.1" as amount of the outbound transaction. The transaction details view on desktop still has the same issues described above as the transaction details view on Android.

adityapk00 commented 3 years ago

Thanks for this. Broadly speaking, self transactions (i.e., transactions that you send to yourself) are problematic to parse in zcash because the wallet can't be certain of some things, so it gets tricky. However, the fee issue seems like a bug, which I will fix.