Skip to content

Multiple fixes/refactorings for ChainLocks - #2765

Merged
UdjinM6 merged 11 commits into
dashpay:developfrom
codablock:pr_llmq_chainlocks_enforce
Mar 13, 2019
Merged

Multiple fixes/refactorings for ChainLocks#2765
UdjinM6 merged 11 commits into
dashpay:developfrom
codablock:pr_llmq_chainlocks_enforce

Conversation

@codablock

@codablock codablock commented Mar 12, 2019

Copy link
Copy Markdown

See individual commits. The PR currently includes #2764 as well as it otherwise runs into deadlocks due to the fix in 5aae9907043da8811d5a0308b0d5fdc723413ff6. I'll remove these commits with a rebase after merge.

The target of this PR is to remove all enforcement logic from signal handlers and move them into the scheduler instead. Otherwise we end up with recursive calls of signals and I don't even want to know what kind of issues might arise from this.

The PR also adds an additional step to enforcement, which is the resetting of failure flags on the CL signed chain. This lets the node retry connecting the correct chain until it eventually succeeds. This is especially important when nodes fork off due to missing superblock triggers.

@UdjinM6 UdjinM6 added this to the 14.0 milestone Mar 12, 2019
@UdjinM6

UdjinM6 commented Mar 12, 2019

Copy link
Copy Markdown

Looks good 👍 Will re-review after rebase.

@UdjinM6

UdjinM6 commented Mar 12, 2019

Copy link
Copy Markdown

Merged #2764 , pls rebase

Calling EnforceBestChainLock might result in switching chains, which in
turn might end up calling signals, so we get into a recursive call chain.

Better to call EnforceBestChainLock from the scheduler.
As the name of this method implies, it's trying to sign something and not
enforce/invalidate chains. Invalidating blocks is the job of
EnforceBestChainLock.
This ensures that NotifyChainLock is not prematurely called before the
block is fully connected.
It might happen that 2 threads enter ActivateBestChain at the same time
start processing block by block, while randomly switching between threads
so that sometimes one thread processed the block and then another one
processes it. A mutex protects ActivateBestChain now against this race.
@codablock
codablock force-pushed the pr_llmq_chainlocks_enforce branch from 5aae990 to 9ba1b4b Compare March 12, 2019 20:20
@codablock

Copy link
Copy Markdown
Author

rebased and force-pushed

@UdjinM6 UdjinM6 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.

See inline comments

Comment thread src/llmq/quorums_chainlocks.cpp Outdated
Comment thread src/llmq/quorums_chainlocks.cpp Outdated

@UdjinM6 UdjinM6 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

@UdjinM6
UdjinM6 merged commit 3a1aeb0 into dashpay:develop Mar 13, 2019
@UdjinM6 UdjinM6 mentioned this pull request Mar 13, 2019
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.

2 participants