Skip to content

Always mark conflicting blocks with BLOCK_CONFLICT_CHAINLOCK flag#3924

Merged
PastaPastaPasta merged 4 commits into
dashpay:developfrom
UdjinM6:moreaccclflag
Jan 16, 2021
Merged

Always mark conflicting blocks with BLOCK_CONFLICT_CHAINLOCK flag#3924
PastaPastaPasta merged 4 commits into
dashpay:developfrom
UdjinM6:moreaccclflag

Conversation

@UdjinM6

@UdjinM6 UdjinM6 commented Jan 11, 2021

Copy link
Copy Markdown

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
Comment thread test/functional/feature_llmq_chainlocks.py Outdated
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

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Member

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?

@xdustinface xdustinface left a comment

Copy link
Copy Markdown

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

Comment thread src/validation.cpp Outdated
Comment thread src/validation.cpp Outdated
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

@xdustinface xdustinface left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

utACK

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Member

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