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

blockchain: Remove unspendable utxo set entries. #2996

Merged
merged 2 commits into from
Sep 28, 2022

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Sep 15, 2022

This requires #2995.


Testing Notes

As of this PR, the expected behavior is that there is a single database update that takes around 1 to 2 seconds to complete after which it will no longer be possible to downgrade.

As the warning above notes, if you try to run an older software version after this migration has completed, you will get an error message similar to Unable to start server: the current UTXO database is no longer compatible with this version of the software (3 > 2)


This adds code to update the utxo database to version 3 which removes outputs from the utxo set that are never directly spendable to avoid needlessly wasting space.

@davecgh davecgh added non-forking consensus Changes that involve modifying consensus code without causing any forking changes. database upgrade Issues and/or pull requests that involve a new database version. labels Sep 15, 2022
@davecgh davecgh added this to the 1.8.0 milestone Sep 15, 2022
@dnldd
Copy link
Member

dnldd commented Sep 15, 2022

Looks good overall, will be running the upgrade soon on mainnet.

@davecgh davecgh force-pushed the blockchain_remove_treasurybase_utxos branch from 542b10c to 836636b Compare September 15, 2022 17:38
@dnldd
Copy link
Member

dnldd commented Sep 16, 2022

Upgrade completed without issue on mainnet.

2022-09-16 10:38:45.413 [INF] CHAN: UTXO cache initializing (max size: 150 MiB)...
2022-09-16 10:38:45.413 [INF] CHAN: Upgrading UTXO database to version 3...
2022-09-16 10:38:45.413 [INF] CHAN: Updating database utxo set.  This may take a while...
2022-09-16 10:38:45.537 [INF] CHAN: Removed 50000 unspendable outputs (50000 total)
2022-09-16 10:38:45.792 [INF] CHAN: Removed 50000 unspendable outputs (100000 total)
2022-09-16 10:38:45.937 [INF] CHAN: Removed 16947 unspendable outputs (116947 total)
2022-09-16 10:38:46.006 [INF] CHAN: Done updating UTXO database.  Total unspendable outputs removed: 116947 in 594ms
2022-09-16 10:38:46.030 [INF] CHAN: Done upgrading database in 617ms.
2022-09-16 10:38:46.030 [INF] CHAN: UTXO cache initialization completed

This modifies the upgrade code for the utxo database to ensure the local
instance of the utxo database info is updated by passing it into the
relevant upgrade functions so that multiple upgrades in a row are
possible.

This makes it consistent with the blockchain database upgrade code.
This adds code to update the utxodb to version 3 which removes outputs
from the utxo set that are never directly spendable to avoid needlessly
wasting space.
@davecgh davecgh force-pushed the blockchain_remove_treasurybase_utxos branch from 836636b to d1b381d Compare September 28, 2022 17:45
@davecgh davecgh merged commit d1b381d into decred:master Sep 28, 2022
@davecgh davecgh deleted the blockchain_remove_treasurybase_utxos branch September 28, 2022 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database upgrade Issues and/or pull requests that involve a new database version. non-forking consensus Changes that involve modifying consensus code without causing any forking changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants