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

[Chain][Bug] Fix mapZerocoinSupply recalculation #1359

Merged
merged 2 commits into from
Mar 2, 2020

Conversation

random-zebra
Copy link

@random-zebra random-zebra commented Feb 26, 2020

df932b8 introduced a bug preventing resync on mainnet due to zerocoin supply recalculation missing.
ZPIV supply recalculation shouldn't be needed in the first place, if the client is syncing from scratch and correctly filtering invalid mints.
So, instead of restoring RecalculateZPIVMinted/RecalculateZPIVSpent, this PR does 2 things:

  • fixes UpdateZPIVSupply filtering the invalid mints/spends since the start of zerocoin (not only after Zerocoin_Block_RecalculateAccumulators). So, syncing from scratch doesn not trigger any recalculation at the next startup.

  • inserts a call to UpdateZPIVSupply directly in RecalculatePIVSupply, to be used during init, e.g. by those clients updating from old versions (with wrong supply in the index), or when using -reindexmoneysupply.
    This removes the additional I/O operations that were originally required with RecalculateZPIVMinted and RecalculateZPIVSpent (as blocks are already read inside RecalculatePIVSupply, and the relative indexes also already updated there).

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK ecc6499

@random-zebra random-zebra requested a review from furszy March 1, 2020 21:12
Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested ACK ecc6499

@furszy furszy merged commit 9869a38 into PIVX-Project:master Mar 2, 2020
@random-zebra random-zebra mentioned this pull request Mar 7, 2020
@random-zebra random-zebra deleted the 2020_zpiv_recalc branch September 24, 2020 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants