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

core: allow to add several headers with StateRootInHeader on #2028

Merged
merged 1 commit into from
Jun 30, 2021

Conversation

AnnaShaleva
Copy link
Member

Problem

With StateRootInHeader setting on only one header of height N+1
can be added to the chain of height N, because we need local stateroot
to verify headers (which is calculated for the last stored block N).
Thus, adding chunk of headers starting from the current chain's heigh
is impossible and (*Blockchain).AddHeaders doesn't have much sense.

Solution

Verify header.PrevStateRoot only for header N+1. Rest of the
headers should be added without PrevStateRoot verification.

@AnnaShaleva AnnaShaleva marked this pull request as draft June 29, 2021 16:06
@AnnaShaleva AnnaShaleva force-pushed the core/fix-add-headers branch from 5752632 to 3b43629 Compare June 29, 2021 16:30
@AnnaShaleva AnnaShaleva marked this pull request as ready for review June 29, 2021 16:33
@roman-khimov roman-khimov added this to the v0.95.4 milestone Jun 30, 2021
Problem: with StateRootInHeader setting on only one header of height N+1
can be added to the chain of height N, because we need local stateroot
to verify headers (which is calculated for the last stored block N).
Thus, adding chunk of headers starting from the current chain's heigh
is impossible and (*Blockchain).AddHeaders doesn't have much sense.

Solution: verify header.PrevStateRoot only for header N+1. Rest of the
headers should be added without PrevStateRoot verification.
@AnnaShaleva AnnaShaleva force-pushed the core/fix-add-headers branch from 3b43629 to 9673a04 Compare June 30, 2021 08:56
@roman-khimov roman-khimov merged commit c203995 into master Jun 30, 2021
@roman-khimov roman-khimov deleted the core/fix-add-headers branch June 30, 2021 14:11
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