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

Always mark conflicting blocks with BLOCK_CONFLICT_CHAINLOCK flag #3924

Merged
merged 4 commits into from
Jan 16, 2021

Conversation

UdjinM6
Copy link

@UdjinM6 UdjinM6 commented Jan 11, 2021

There is an inconsistency in the way we handle conflicting blocks atm - we add blocks to the block index as conflicting in AcceptBlockHeader but we mark re-orged blocks as invalid in EnforceBestChainLock. Because of the latter, it works most of the time despite the fact that some logic for conflicting blocks is actually missing. This PR should fix it by always sticking to the BLOCK_CONFLICT_CHAINLOCK flag for conflicting blocks and implementing all the required logic around it.

EDIT: the flag was introduced in #2923 btw

@UdjinM6 UdjinM6 added the RPC Some notable changes to RPC params/behaviour/descriptions label Jan 11, 2021
@UdjinM6 UdjinM6 added this to the 17 milestone Jan 11, 2021
@UdjinM6 UdjinM6 marked this pull request as ready for review January 11, 2021 11:42
Co-authored-by: thephez <thephez@users.noreply.github.com>
@UdjinM6 UdjinM6 changed the title More accurate handling of the BLOCK_CONFLICT_CHAINLOCK flag Always mark conflicting blocks with BLOCK_CONFLICT_CHAINLOCK flag Jan 14, 2021
Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

Can you introduce a regression test for this?

Copy link

@xdustinface xdustinface left a comment

Choose a reason for hiding this comment

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

Looks good, just one potential change see below

src/validation.cpp Outdated Show resolved Hide resolved
src/validation.cpp Outdated Show resolved Hide resolved
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Copy link

@xdustinface xdustinface left a comment

Choose a reason for hiding this comment

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

utACK

Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

utACK

@PastaPastaPasta PastaPastaPasta merged commit 482ba4f into dashpay:develop Jan 16, 2021
@UdjinM6 UdjinM6 deleted the moreaccclflag branch July 1, 2021 21:55
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Mar 13, 2022
…shpay#3924)

* More accurate handling of the BLOCK_CONFLICT_CHAINLOCK flag

* Update test/functional/feature_llmq_chainlocks.py

Co-authored-by: thephez <thephez@users.noreply.github.com>

* tests: make sure that previous tip on the reorged node is marked conflicting after chainlock

* Apply suggestions from code review

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

Co-authored-by: thephez <thephez@users.noreply.github.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RPC Some notable changes to RPC params/behaviour/descriptions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants