bitkit icon indicating copy to clipboard operation
bitkit copied to clipboard

[Bug]: Balance can be 0 (zero) when transactions sum to a positive value

Open catch-21 opened this issue 1 year ago • 3 comments

Describe the bug

Previously having the correct balance displayed in my wallet, on opening my app just now I am shown a balance of 0 even though there are clearly transactions that add up to a positive value. I have a stable electrum server connection and pulling down from the top to refresh does not fix the value. As you can see in the attached recording, the Ledger view highlights that the actual balance does not reflect the expected.

Reproduce

Unsure of how I got here but it doesn't seem to want to correct itself, even after closing and reopening the app.

Screenshots / Recording

https://github.com/synonymdev/bitkit/assets/74595920/5d14a7d8-c892-4dc9-9997-8908c5471376

Operating system

Android 13 TKQ1.220829.002

Bitkit version

c55c045f58b7e76ee82acdc1419bccf9db8490ae

Log output

No response

catch-21 avatar Apr 24 '24 16:04 catch-21

Please try the following to resolve:

  • Navigate to and tap Settings->Advanced->Rescan Addresses

It looks like your utxos may have been cleared out somehow. That's how Bitkit derives it's balance. Re-scanning should resolve it. One way we may be able to prevent this for some users is to perform a re-scan in the background in the event Bitkit detects a discrepancy between ledger and the current balance derived via the utxos.

coreyphillips avatar Apr 24 '24 16:04 coreyphillips

@coreyphillips Sadly, I have since restored my wallet and am no longer seeing this issue. It's interesting that, if I clear UTxO cache and then pull down on the main screen then the balance corrects itself. This wasn't the case for the state I got myself into. It makes sense for the ledger to be detecting and handling this.

catch-21 avatar Apr 24 '24 19:04 catch-21

Happened again (mainnet 20c194faaf1dc812c806fd7b47730f35a4c94286). This time following on from the steps in https://github.com/synonymdev/bitkit/issues/1645#issuecomment-2088529196, I closed Bitkit and reopened it to see if the transactions would correctly update their status as 'removed from mempool'. They had not, and now I cannot view my balance or make any payments.

When attempting send funds the UI is unresponsive and no error. Logs:

 LOG  [TypeError: Cannot read property 'getFeeEstimates' of undefined]
 LOG  [TypeError: Cannot read property 'transaction' of undefined]

When attempting to rescan addresses it fails. Logs:

 LOG  [Error: backup_setup_required]
 LOG  [TypeError: Cannot read property 'refreshWallet' of undefined]
 LOG  [TypeError: Cannot read property 'generateAddresses' of undefined]
 LOG  [TypeError: Cannot read property 'generateAddresses' of undefined]
 LOG  [TypeError: Cannot read property 'generateAddresses' of undefined]
 LOG  [TypeError: Cannot read property 'generateAddresses' of undefined]
 LOG  generateAddressResponse error Cannot read property 'generateAddresses' of undefined
 LOG  generateAddressResponse error Cannot read property 'generateAddresses' of undefined
 LOG  generateAddressResponse error Cannot read property 'generateAddresses' of undefined
 LOG  generateAddressResponse error Cannot read property 'generateAddresses' of undefined

https://github.com/synonymdev/bitkit/assets/74595920/49ecd27c-83d0-4edb-bff1-40c1f7fce344

catch-21 avatar May 01 '24 15:05 catch-21

Likely fixed by #2210 , closing.

pwltr avatar Sep 10 '24 11:09 pwltr

I have not seen this in any wallet, including the one used when this issue was created. Agree this is probably not going to occur thanks to https://github.com/synonymdev/bitkit/pull/2210. Marking Done.

catch-21 avatar Sep 10 '24 13:09 catch-21