Chia-Network / chia-blockchain

Chia blockchain python implementation (full node, farmer, harvester, timelord, and wallet)
Apache License 2.0
10.82k stars 2.03k forks source link

[Bug] Wrong coin balance #14355

Closed blupino closed 1 year ago

blupino commented 1 year ago

What happened?

I have been noticing this few times, quite easy to reproduce. In short just do a normal send XCH to another addres, for my case I sent 1.01 XCH twice to different address, and after they settled it will show incorrect balance. The remedy for this issue is I need to restart chia client and after sync completed, it will show correct balance.

The balance will never get updated if I just wait it out, I need to restart the client

This is the wrong balance, and it also show the 2 transaction I did bug-coin

And this is the correct balance after restart bug-coin1

Version

1.7.0b5.dev29

What platform are you using?

Linux

What ui mode are you using?

GUI

Relevant log output

No response

blupino commented 1 year ago

Just now I encounter similar issue again but slighly different. This time it involved "Delete Unconfirmed Transaction". Apparently the previous transaction has completed, but the XCH balance somehow didn't get updated and if I "Delete Unconfirmed Transaction", the balance become incorrect.

MumfMeisterT commented 1 year ago

What do you mean by restart the client? Also how many CATs do you have? Can you check the CLI to see if the CLI matches the GUI balances? -- Run chia wallet show and see if amount is correct.

blupino commented 1 year ago
  1. Previously I was using 1.7.0b5.dev29 from git checkout. Now I change it with 1.7.0b5 from beta release. So far I haven't notice the issue again.
  2. I didn't see discrepancy between CLI and GUI at the moment
  3. Restart client means, I close the client and re-open.
  4. 13 CATs
blupino commented 1 year ago

I saw this issue again, now in 1.6.2.

  1. I transfer CAT to my other wallet
  2. After completed, the GUI show wrong balance.
  3. chia wallet show, also shows the same wrong balance as GUI
  4. The GUI sync indicator is green (probably misleading)
  5. restart fix this issue

For info my wallet is configured to only connect to my local LAN full node with version 1.7.0b5

blupino commented 1 year ago

I delete my wallet db and start over. So far seems more stable. Previously even cancelling offer can cause missing coin issue

MumfMeisterT commented 1 year ago

Did you happen to save a copy of the wallet db, or did you delete completely? Are you sending these CATs to the same key, or a separate wallet?

Could you please let us know if you see this error in your logs. It should look like Error adding state...

blupino commented 1 year ago

I grep-ed on the log folder grep -i "adding state" -r *, and don't see any hit. I think the log already missing because I only have the latest log yesterday evening. I do keep the wallet db though, but I worry it will be privacy issue if exposed :)

So far the issue seems resolved. Previously it was slow even transfer coin to varied address in sequence.

blupino commented 1 year ago

The issue still exist. On 1.6.2, I did offer of CAT for XCH. When I cancel the offer, the CAT is not added back to balance. Another case when I make an offer of CAT for XCH, and if I purposely accept this offer myself. The balance of CAT become "stuck/never complete".. and when I delete unconfirmed transaction the balance become incorrect

HVNC1 commented 1 year ago

try increasing the derivation index and wait for the changes to apply image image

trgarrett commented 1 year ago

I've seen a similar issue, up through and including 1.7.0-rc4.

I have been gradually gathering CAT tokens for the Tai Chia DAO. I am sending them to the same address so I can review my future dividends activity easily on the blockchain explorer (primarily to properly record income). So, my use case is sending a CAT balance from one address to another address that both belong to the same wallet. The transaction showing the debit will be correctly handled, but the corresponding deposit does not get handled. No amount of waiting will bring it in, although a restart of the wallet process triggering a resync from an earlier block position will fix the issue.

It seems like debits from any of your addresses are correctly processed while reading from the blockchain, but they are not processed on send from the wallet. Presumably when the transaction is confirmed, it is simply moving the recorded transaction from Pending to Confirmed and not creating the offset for the deposit.

blupino commented 1 year ago

So far not happen with newly released 1.7.0, :crossed_fingers:

blupino commented 1 year ago

No longer see this problem on1.8.0b3, and it seems more responsive to divide big coin into smaller coin now compared with 1.7.0.