Do not fill in blocks that are not in the finalized branch (#10776)

* Do not fill in blocks that are not in the finalized branch

* mark blocks as invalid

* Fix old off-by-ones, do not pass finalized state
This commit is contained in:
Potuz
2022-05-30 08:55:39 -03:00
committed by GitHub
parent 364ad3fbda
commit 3ff285dda5
3 changed files with 95 additions and 38 deletions

View File

@@ -27,6 +27,8 @@ var (
errWSBlockNotFound = errors.New("weak subjectivity root not found in db")
// errWSBlockNotFoundInEpoch is returned when a block is not found in the WS cache or DB within epoch.
errWSBlockNotFoundInEpoch = errors.New("weak subjectivity root not found in db within epoch")
// errNotDescendantOfFinalized is returned when a block is not a descendant of the finalized checkpoint
errNotDescendantOfFinalized = invalidBlock{errors.New("not descendant of finalized checkpoint")}
)
// An invalid block is the block that fails state transition based on the core protocol rules.