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

spv: Move validate header chain difficulties to earlier point in startup sync #2297

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

matheusd
Copy link
Member

@matheusd matheusd commented Nov 13, 2023

This moves the header chain difficulty validation to an earlier point in time of the initial sync process.

This is preferable so that less work is performed in case invalid headers are received.

This PR includes a commit to move the p2p package logs to a separate subsystem, so that the syncing process can be logged with a higher logging level while not producing significant log spam due to individually logging each peer message.

Part of #2289

This makes it easier to debug SPV sync issues by allowing more debugging
info for the sync process itself, as opposed to all peer messages
exchanged.
This moves the header chain difficulty validation to an earlier point in
time of the initial sync process.

This is preferable so that less work is performed in case invalid
headers are received.
s.sidechainMu.Unlock()
return err
}
_, err = s.wallet.ValidateHeaderChainDifficulties(ctx, fullsc, 0)
Copy link
Member

Choose a reason for hiding this comment

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

This seems fine for now, if only because ValidateHeaderChainDifficulties, despite using a slice of BlockNodes, only actually checks the headers and doesn't need the cfilters to be populated. Since we have the chance to change the API, we may want to change that to take a slice of headers instead (can be in a future change).

@jrick jrick merged commit d9d3f17 into decred:master Nov 13, 2023
2 checks passed
@matheusd matheusd deleted the move-validate-headers branch November 13, 2023 16:02
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