Electric-Coin-Company / zashi-android

The Zashi Zcash Wallet, Android Edition
MIT License
22 stars 15 forks source link

Incorrect transaction history displayed while wallet is partially recovered from seed #1444

Open str4d opened 4 months ago

str4d commented 4 months ago

Describe the issue

Due to the order in which the scan queue is populated, during recover-from-seed the notes in the current incomplete subtree are scanned before any historical notes. If a transaction was sent in that recent period, the wallet shows it in transaction history as being a received transaction with the amount from the change output, but with the memo from the sent output.

After waiting for the wallet to progress further in sync, the transaction history changes to correctly show the transaction as "Sent", so the wallet information is eventually correct, but in the intervening time the user is presented with misleading information.

Can you reliably reproduce the issue?

If so, please list the steps to reproduce below:

  1. Have unspent notes in a wallet that are not within the current incomplete subtree.
  2. Spend those notes to send funds outside the wallet with some associated memo, creating a change note.
  3. Open a new Zashi and recover the wallet from its mnemonic phrase.
  4. Wait for the sent transaction to be detected.

Expected behavior

The transaction shows up as "Sent -recipientAmount", with the outgoing memo.

Actual behavior + errors

The transaction shows up as "Received +changeAmount", but with the outgoing memo, making it look like the memo was sent by someone else to the wallet.