Skip to content

Conversation

@maflcko
Copy link
Member

@maflcko maflcko commented Jul 11, 2024

These errors should never happen in normal operation. If they do,
knowing the FlatFilePos may be useful to determine if data corruption
happened. Also, handle the error pos.IsNull() as part of OpenUndoFile,
because it may as well have happened due to data corruption.

This mirrors the LogError behavior from ReadBlockFromDisk.

Also, two other fixup commits in this module.

MarcoFalke added 3 commits July 11, 2024 15:39
Member fields are used read-only in this method.
These errors should never happen in normal operation. If they do,
knowing the FlatFilePos may be useful to determine if data corruption
happened. Also, handle the error pos.IsNull() as part of OpenUndoFile,
because it may as well have happened due to data corruption.

This mirrors the LogError behavior from ReadBlockFromDisk.
These errors should never happen. However, when they do happen, it is
useful to log the correct error location (function name).

For example, this fixes an incorrect "ConnectBlock()" in
"WriteUndoDataForBlock".
@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 11, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK kevkevinpal, tdb3, ryanofsky

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #30364 (logging: Replace LogError and LogWarning with LogAlert by ryanofsky)
  • #27006 (reduce cs_main scope, guard block index 'nFile' under a local mutex by furszy)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@DrahtBot DrahtBot changed the title log: LogError with FlatFilePos in UndoReadFromDisk log: LogError with FlatFilePos in UndoReadFromDisk Jul 11, 2024
@kevkevinpal
Copy link
Contributor

ACK fa14e1d

I think this makes sense and mirroring ReadBlockFromDisk seems reasonable to me

Copy link
Contributor

@tdb3 tdb3 left a comment

Choose a reason for hiding this comment

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

cr and light test ACK fa14e1d

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Code review ACK fa14e1d. This should make logging clearer and more consistent

@ryanofsky ryanofsky merged commit 8426e01 into bitcoin:master Jul 15, 2024
@maflcko maflcko deleted the 2407-log-err-undo branch July 16, 2024 08:02
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jun 17, 2025
Summary:
> This makes it harder to pass nullptr and cause issues such as
> bitcoin/bitcoin@dde7ac5

bitcoin/bitcoin@fa5989d

> refactor: Mark IsBlockPruned const
>
> Member fields are used read-only in this method.

bitcoin/bitcoin@aaaa332

This is a partial backport of [[bitcoin/bitcoin#29021 | core#29021]] and [[bitcoin/bitcoin#30428 | core#30428]]
Depends on D18256

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D18257
@bitcoin bitcoin locked and limited conversation to collaborators Jul 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants