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

feat: process/accept CbTx CL as new CL #5779

Closed
wants to merge 2 commits into from

Conversation

ogabrielides
Copy link
Collaborator

@ogabrielides ogabrielides commented Dec 19, 2023

Issue being fixed or feature implemented

We should process/accept CbTx CL as new CL as we process/accept new blocks.

What was done?

How Has This Been Tested?

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-cbtx-invalid-clsig");
}
chainlock_handler.ProcessNewChainLock(-1, cbtxcl, ::SerializeHash(cbtxcl));
Copy link

Choose a reason for hiding this comment

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

I see a couple of issues with this:

  1. A syncing node will spam the network with old clsigs because of RelayInv inside of ProcessNewChainLock.
  2. We are going to run VerifyChainLock twice in a row it seems - first here and then again inside of ProcessNewChainLock.

We should probably avoid processing any clsigs (these and p2p ones) until blockchain is synced. Pls see 93ed4e1.

Copy link
Member

Choose a reason for hiding this comment

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

What if we instead extract this code

{
LOCK(cs);
bestChainLockHash = hash;
bestChainLock = clsig;
if (pindex != nullptr) {
if (pindex->nHeight != clsig.getHeight()) {
// Should not happen, same as the conflict check from above.
LogPrintf("CChainLocksHandler::%s -- height of CLSIG (%s) does not match the specified block's height (%d)\n",
__func__, clsig.ToString(), pindex->nHeight);
// Note: not relaying clsig here
return;
}
bestChainLockWithKnownBlock = bestChainLock;
bestChainLockBlockIndex = pindex;
}
// else if (pindex == nullptr)
// Note: make sure to still relay clsig further.
}
to a new function and only call this function on block processing?

So avoid the re-verification and enforcement?

Copy link

Choose a reason for hiding this comment

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

might work.. not sure

src/evo/cbtx.cpp Show resolved Hide resolved
@PastaPastaPasta
Copy link
Member

Guix Automation has failed due to the HEAD commit not being signed by an authorized core-team member. Please rebase and sign or push a new empty signed commit to allow Guix build to happen.

2 similar comments
@PastaPastaPasta

This comment was marked as duplicate.

@PastaPastaPasta

This comment was marked as duplicate.

Copy link

This pull request has conflicts, please rebase.

@ogabrielides ogabrielides deleted the process_cbtx_cl branch January 29, 2024 16:02
@UdjinM6 UdjinM6 removed this from the 20.1 milestone Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants