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] Fix g_best_block initialization in ABC #1457

Conversation

random-zebra
Copy link

g_best_block holds a cached best block hash.
This is updated during ActivateBestChain (in UpdateTip).

Problem: at startup, the object is not initialized until a new block arrives (ActivateBestChainStep is not called) thus g_best_block != chainActive.Tip()->GetBlockHash() so, if the client stakes before receiving a new block, that stake gets orphaned.
In case of segregated devnet with just one staker, it is impossible to move the chain at all.

@random-zebra random-zebra added Bug Block Generation Mining/Staking related issues labels Mar 24, 2020
@random-zebra random-zebra added this to the 4.1.0 milestone Mar 24, 2020
@random-zebra random-zebra self-assigned this Mar 24, 2020
@random-zebra
Copy link
Author

Some more context.
Probable related issue (on PoW phase): #1285
The issue does not emerge on RegTest as, there, we call directly ProcessNewBlock, and do not use the internal miner ProcessBlockFound (where the g_best_block check is performed).

@random-zebra random-zebra force-pushed the 202003_g_best_block_initialization branch 2 times, most recently from 602dcf2 to f3dc201 Compare March 24, 2020 20:40
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.

utACK 7d9adb8

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 7d9adb8

@random-zebra random-zebra merged commit 841f702 into PIVX-Project:master Mar 26, 2020
@random-zebra random-zebra deleted the 202003_g_best_block_initialization branch September 24, 2020 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Block Generation Mining/Staking related issues Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants