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

RPC: Avoid assert by keeping a flag to identify trimmed dynafed blocks #1225

Merged
merged 2 commits into from
Mar 17, 2023

Conversation

psgreco
Copy link
Contributor

@psgreco psgreco commented Mar 16, 2023

This MR fixes 2 crashes:

  1. assert in blockheaderToJSON when checking for dynafed block on a trimmed header
  2. crash in blocktoJSON/blockheaderToJSON due to loaded block being incomplete.

Fixes: #1224

@psgreco psgreco force-pushed the master-fix-assert-trim-rpc branch from cb41349 to 8f16e00 Compare March 16, 2023 12:21
@psgreco psgreco requested a review from gwillen March 16, 2023 12:22
@psgreco psgreco self-assigned this Mar 16, 2023
@psgreco psgreco requested a review from delta1 March 16, 2023 12:23
@delta1
Copy link
Member

delta1 commented Mar 16, 2023

utack 8f16e00

@delta1 delta1 merged commit 6b826d5 into ElementsProject:master Mar 17, 2023
@psgreco psgreco deleted the master-fix-assert-trim-rpc branch March 17, 2023 14:58
@@ -228,6 +230,13 @@ class CBlockIndex
return proof.value();
}

const bool dynafed_block() const {
Copy link
Contributor

Choose a reason for hiding this comment

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

Clang says

'const' type qualifier on return type has no effect

Copy link
Member

Choose a reason for hiding this comment

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

yeah this warning has been annoying me, I thought it was fixed on the 22.x branch but it is not

Choose a reason for hiding this comment

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

Thank you for posting this, but it has no effect on my RPI4 even though I have the latest version. On startup I get the same assert error. Any tips for me?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you see the assertion on startup, it usually means that you started IBD without trim_headers and then enabled trim_headers without finishing IBD, so the headers chain is much longer than the blocks. Either way, let's continue that conversation in #1240

delta1 added a commit to delta1/elements that referenced this pull request Jul 3, 2023
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.

Assert crash on getblockheader on a trimmed header
4 participants