Skip to content

Commit

Permalink
chore: forbidden validate body use parent
Browse files Browse the repository at this point in the history
  • Loading branch information
joeylichang committed Dec 6, 2024
1 parent 7f8183c commit 68bdc80
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions core/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error {
}
return nil
},
func() error {
if !v.bc.HasBlockAndState(block.ParentHash(), block.NumberU64()-1) {
if !v.bc.HasBlock(block.ParentHash(), block.NumberU64()-1) {
return consensus.ErrUnknownAncestor
}
return consensus.ErrPrunedAncestor
}
return nil
},
//func() error {
// if !v.bc.HasBlockAndState(block.ParentHash(), block.NumberU64()-1) {
// if !v.bc.HasBlock(block.ParentHash(), block.NumberU64()-1) {
// return consensus.ErrUnknownAncestor
// }
// return consensus.ErrPrunedAncestor
// }
// return nil
//},
func() error {
if v.remoteValidator != nil && !v.remoteValidator.AncestorVerified(block.Header()) {
return fmt.Errorf("%w, number: %s, hash: %s", ErrAncestorHasNotBeenVerified, block.Number(), block.Hash())
Expand Down

0 comments on commit 68bdc80

Please sign in to comment.