Skip to content

blockchain: Consolidate not in main chain err fmt. #3492

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

Merged

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Jun 12, 2025

This consolidates the error formatting logic for the various cases when a block that is not in the main chain is requested either by height or hash.

Rather than having a single generic error string that represents the various cases and repeatedly formatting the errors at each call site, this introduces two individual errors of the appropriate types and moves the error formatting onto the types.

It also updates the tests to remove isNotInMainChainErr which is a holdover that is no longer needed due to previous changes, as well as to ensure the new formatted error strings are the expected output.

@davecgh davecgh added this to the 2.1.0 milestone Jun 12, 2025
@davecgh davecgh changed the title blockchain: Consolide not in main chain err format. blockchain: Consolidate not in main chain err format. Jun 13, 2025
This consolidates the error formatting logic for the various cases when
a block that is not in the main chain is requested either by height or
hash.

Rather than having a single generic error string that represents the
various cases and repeatedly formatting the errors at each call site,
this introduces two individual errors of the appropriate types and moves
the error formatting onto the types.

It also updates the tests to remove isNotInMainChainErr which is a
holdover that is no longer needed due to previous changes, as well as to
ensure the new formatted error strings are the expected output.
@davecgh davecgh force-pushed the blockchain_consolidate_not_in_main_chain_errs branch from dc46373 to 19cc05b Compare June 13, 2025 00:16
@davecgh davecgh changed the title blockchain: Consolidate not in main chain err format. blockchain: Consolidate not in main chain err fmt. Jun 13, 2025
@davecgh davecgh merged commit 19cc05b into decred:master Jun 13, 2025
2 checks passed
@davecgh davecgh deleted the blockchain_consolidate_not_in_main_chain_errs branch June 13, 2025 16:05
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