Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] wallet update states and subscribes to a HUGE number of already spent coins on restart #17013

Open
iliasorazov opened this issue Dec 7, 2023 · 16 comments
Assignees
Labels
bug Something isn't working

Comments

@iliasorazov
Copy link

What happened?

The wallet is very active but only has 2-6 unspent coins now.

The restart takes ~20 minutes and there are following lines in the log:

INFO Successfully subscribed and updated 852 puzzle hashes
INFO new coin state received (1-900/ 1000)
INFO new coin state received (901-1000/ 1000)
<skipped 226 lines>
INFO new coin state received (1-900/ 1000)
INFO new coin state received (901-1000/ 1000)
INFO new coin state received (1-556/ 556)
INFO Successfully subscribed and updated 115556 coin ids

It seams that coins comes from the interested_coins table which has 115556 records now and there is only one place in the code where these coins are removed:

if record.coin_type == CoinType.CLAWBACK:
await self.interested_store.remove_interested_coin_id(coin_state.coin.name())

But what about normal coins? What about rewards? Why the wallet is interested in already spent coins and takes forever to restart? This doesn't seems right.

Any suggestions?

Version

2.1.1

What platform are you using?

Linux

What ui mode are you using?

CLI

Relevant log output

No response

@iliasorazov iliasorazov added the bug Something isn't working label Dec 7, 2023
@wjblanke
Copy link
Contributor

We are planning to improve how the lite wallet syncs if it has existing state and has a trusted node.

@iliasorazov
Copy link
Author

iliasorazov commented Dec 13, 2023

Does it mean that a wallet can not be sure that the coin reported as spent is actually spent based on the information provided by the node and this is why it resyncs all the coins states every time it restarts? Why it removes CLAWBACK coins from the list of interested coins then?

@iliasorazov
Copy link
Author

The last time wallet took more than an hour to start. The increase in time is caused by high network load due to dust storm but the root cause is very very inefficient wallet bootstrap procedure. Is there any simple solution you can suggest? How should I patch the code not to broke it and get rid of these massive spent coins synchronization?

Copy link
Contributor

github-actions bot commented Jan 1, 2024

This issue has not been updated in 14 days and is now flagged as stale. If this issue is still affecting you and in need of further review, please comment on it with an update to keep it from auto closing in 7 days.

@github-actions github-actions bot added the stale-issue flagged as stale and will be closed in 7 days if not updated label Jan 1, 2024
@iliasorazov
Copy link
Author

Hey! The issue is very actual

@github-actions github-actions bot removed the stale-issue flagged as stale and will be closed in 7 days if not updated label Jan 2, 2024
@iliasorazov
Copy link
Author

@wjblanke can we expect performance improvements in the nearest months? In the next release.

Copy link
Contributor

This issue has not been updated in 14 days and is now flagged as stale. If this issue is still affecting you and in need of further review, please comment on it with an update to keep it from auto closing in 7 days.

@github-actions github-actions bot added the stale-issue flagged as stale and will be closed in 7 days if not updated label Jan 18, 2024
@wjblanke
Copy link
Contributor

Running a local node (which is thus trusted) will speed up the wallet syncing process, since coins will not need to be validated. We are working on lite wallet improvements for remote untrusted nodes.

@iliasorazov
Copy link
Author

Every transfer a wallet made adds a coin into the interested_coins table. The table is never cleared up by the wallet itself, even when a coin is spent. The list of coins is only growing and all those coins are subscribed on restart causing the huge slow down. This is obviously a bug. Currently we circumvent the issue by clearing up or ignoring the interested_coins in the code.

@github-actions github-actions bot removed the stale-issue flagged as stale and will be closed in 7 days if not updated label Jan 25, 2024
@wjblanke
Copy link
Contributor

Thanks we will look into this

@arvidn
Copy link
Contributor

arvidn commented Feb 14, 2024

the fundamental problem is that the wallet doesn't remember how far we synced the wallet in the last session. Every time we start the wallet we sync from scratch. This is something we're working towards fixing with an improved wallet protocol.

@wjblanke
Copy link
Contributor

wjblanke commented Mar 13, 2024

We are working on a new wallet protocol that will support this. We may have a branch soon, here is the work in progress
#17340

This is being discussed in this CHIP
Chia-Network/chips#100

And there is this community effort as well
#17573

@iliasorazov
Copy link
Author

I suspect that the problem with ever growing interested_coins table is different. At least clearing it up helps and do not cause any other issues.

@wjblanke
Copy link
Contributor

You could try main with the above "use_delta_sync" option.

@wjblanke
Copy link
Contributor

wjblanke commented May 1, 2024

use_delta_sync is in 2.3.0 as well

@wjblanke
Copy link
Contributor

The new wallet protocol is implemented but wallet has not been updated yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants