Skip to content

Conversation

fjahr
Copy link
Contributor

@fjahr fjahr commented Jan 23, 2022

This change lets the coinstatsindex fail loudly in case the internal muhash state differs from the last finalized output saved on disk, which would indicate that the muhash state somehow got out of sync. This should generally not happen since both are written to disk in a batch but #24076 seems to indicate that the might still be an issue.

Since #24076 so far can not be reproduced reliably, the issue should not be closed yet. Further investigation and testing needs to be done.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 23, 2022

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

Conflicts

No conflicts as of last run.

@mzumsande
Copy link
Contributor

Concept ACK.

I was just able to locally reproduce the fails reported in #24076 and find the root cause - will report in more detail / possibly PR a fix tomorrow. This additional check makes sense in any case.

@mzumsande
Copy link
Contributor

ACK 2fc159b - I verified that init aborts now for a corrupted index, and doesn't abort for an uncorrupted one.

Copy link
Member

@Sjors Sjors left a comment

Choose a reason for hiding this comment

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

ACK 2fc159b

Maybe also annotate MuHash3072 m_muhash; in the header to point out a MuHash is initialized to 1 by default.

@fjahr fjahr force-pushed the 2022-01-index-fixups branch from 2fc159b to 820c03a Compare February 16, 2022 23:43
@fjahr
Copy link
Contributor Author

fjahr commented Feb 16, 2022

Rebased

@Sjors
Copy link
Member

Sjors commented Feb 17, 2022

re-ACK 820c03a

1 similar comment
@mzumsande
Copy link
Contributor

re-ACK 820c03a

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 820c03a. Good to catch the error earlier

uint256 out;
m_muhash.Finalize(out);
if (entry.muhash != out) {
return error("%s: Cannot read current %s state; index may be corrupted",
Copy link
Contributor

Choose a reason for hiding this comment

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

In commit "index: check muhash is in sync on coinstatsindex launch" (820c03a)

I wonder if it would be good to include hashes or other information in this message (transaction total numbers, pindex height) in the error message, especially if this is supposed to help debug an unresolved issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

re: #24133 (comment)

I wonder if it would be good to include hashes or other information in this message

Never mind if #24138 fixes this though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will address this together with your idea for a unit test here in a small follow-up.

@fanquake fanquake merged commit 5f44c5c into bitcoin:master Feb 20, 2022
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Feb 20, 2022
…estart

820c03a index: check muhash is in sync on coinstatsindex launch (Fabian Jahr)
38ed58b index: remove txindex references from base index (Fabian Jahr)

Pull request description:

  This change lets the `coinstatsindex` fail loudly in case the internal `muhash` state differs from the last finalized output saved on disk, which would indicate that the `muhash` state somehow got out of sync. This should generally not happen since both are written to disk in a batch but bitcoin#24076 seems to indicate that the might still be an issue.

  Since bitcoin#24076 so far can not be reproduced reliably, the issue should not be closed yet. Further investigation and testing needs to be done.

ACKs for top commit:
  Sjors:
    re-ACK 820c03a
  mzumsande:
    re-ACK 820c03a
  ryanofsky:
    Code review ACK 820c03a. Good to catch the error earlier

Tree-SHA512: 3c985d7152698d25bad95d4ad512ff87dff13fabef790589c5a6cf93ca4251ad599e12feb7251a084503e2a213b022eaacfbaaa601464114ad372b029f64f204
@bitcoin bitcoin locked and limited conversation to collaborators Feb 20, 2023
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.

7 participants