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

[WIP] Implement rewind block index to last checkpoint functionality #2298

Closed

Conversation

furszy
Copy link

@furszy furszy commented Apr 6, 2021

Adding functionality to rollback the chain up to the last known checkpoint.

As we have a max depth reorg limit, this is useful in many scenarios. The one that happen often is over every upgrade enforcement where users update late and continue running on a forked chain for a long time. With this, they will be able to get back to the main chain just pressing a button in the GUI, without having to invalidate the chain manually nor sync from scratch.

Another future step forward from this PR would be to automate the rewind process but there are several other factors that need to be contemplated in order to do it.

TODO:

  • Add test coverage.
  • Add visual connection.
  • Add way more checkpoints in the zerocoin active window.

@furszy furszy self-assigned this Apr 6, 2021
@furszy furszy added this to the 6.0.0 milestone Apr 11, 2021
random-zebra added a commit that referenced this pull request May 5, 2021
529ff1f [Refactoring] Stop writing zerocoin mints in the DB (random-zebra)
6b51e1c [Cleanup] Remove unused ReadCoinMint/EraseCoinMint (key 'm') in zc DB (random-zebra)

Pull request description:

  We should have never databased the "public coins" in the first place, and it's beyond useless now.

  With this simple removal we get a 20~25% speedup during they sync of the interested blocks [`863787` -> `1880000`], and, as bonus, we save 60MB of disk space.

ACKs for top commit:
  Fuzzbawls:
    ACK 529ff1f
  furszy:
    Now that we have #2298 and #2364 test, ACK 529ff1f .

Tree-SHA512: 9d053538158cd271e64ab70bc3aa913256d3a4386c02e961c2776b45b0694221d3f0919a5992c8e652271783fc2d81729df48fbbb11d0c3f1ba9704e0654c893
furszy added a commit that referenced this pull request May 5, 2021
cb276f4 [Cleanup] Remove zerocoin accumulators (random-zebra)
4772fbd [Cleanup] Remove unused PrivateCoin class (random-zebra)
1371fa4 [Cleanup] Remove now unused randKBitBignum (random-zebra)
0da394b [Cleanup] Remove unused Parameter generation utility for zerocoin (random-zebra)

Pull request description:

  Remove some dead code.
  More cleanup in the area will be done after #2298

ACKs for top commit:
  Fuzzbawls:
    ACK cb276f4
  furszy:
    ACK cb276f4 and merging..

Tree-SHA512: 229ac954b0f3f03a3e627c0ac01d2a26294b80d0f5699fc3cac0c79853a653a755799460ceb09ff2aaf3c6e151314868509223a9c5d8c6f26ef29b39fd2a184e
@furszy furszy modified the milestones: 5.3.0, 6.0.0 Jul 30, 2021
PeterL73 added a commit to PeterL73/PIVX that referenced this pull request Nov 11, 2022
add testnet checkpoints
- 925056 (lastblock before v5.5)
- 925057 (firstblock after v5.5)
- 925063 (added to circumvent failure on last (default 6) blocks verification due to PIVX-Project#2772)
add -rewindblockindextolastcheckpoint option
add RewindBlockIndexToLastCheckpoint to init Step 7: load block chain
modify RewindBlockIndexToLastCheckpoint
- check if rewind is needed
- use targetHeight instead of targetHash
- add progress indicator
on rewind
- clearWitnessCaches
- zap all transactions from wallet
- rescan wallet transactions
- restore wallet transaction metadata after rescan (unless -zapwallettxes=2)
add functional test
PeterL73 added a commit to PeterL73/PIVX that referenced this pull request Nov 11, 2022
add testnet checkpoints
- 925056 (lastblock before v5.5)
- 925057 (firstblock after v5.5)
- 925063 (added to circumvent failure on last (default 6) blocks verification due to PIVX-Project#2772)
add -rewindblockindextolastcheckpoint option
add RewindBlockIndexToLastCheckpoint to init Step 7: load block chain
modify RewindBlockIndexToLastCheckpoint
- check if rewind is needed
- use targetHeight instead of targetHash
- add progress indicator
on rewind
- clearWitnessCaches
- zap all transactions from wallet
- rescan wallet transactions
- restore wallet transaction metadata after rescan (unless -zapwallettxes=2)
add functional test
PeterL73 added a commit to PeterL73/PIVX that referenced this pull request Nov 11, 2022
add testnet checkpoints
- 925056 (lastblock before v5.5)
- 925057 (firstblock after v5.5)
- 925063 (added to circumvent failure on last (default 6) blocks verification due to PIVX-Project#2772)
add -rewindblockindextolastcheckpoint option
add RewindBlockIndexToLastCheckpoint to init Step 7: load block chain
modify RewindBlockIndexToLastCheckpoint
- check if rewind is needed
- use targetHeight instead of targetHash
- add progress indicator
on rewind
- clearWitnessCaches
- zap all transactions from wallet
- rescan wallet transactions
- restore wallet transaction metadata after rescan (unless -zapwallettxes=2)
add functional test
@furszy furszy closed this Nov 29, 2022
@furszy furszy deleted the 2020_rewind_to_last_block_index branch November 29, 2022 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant