Skip to content

Commit

Permalink
fix the get header error
Browse files Browse the repository at this point in the history
  • Loading branch information
blxdyx committed Sep 2, 2024
1 parent bed9444 commit be6a506
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions consensus/parlia/parlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ func (p *Parlia) distributeFinalityReward(chain consensus.ChainHeaderReader, sta
head := header
accumulatedWeights := make(map[libcommon.Address]uint64)
for height := currentHeight - 1; height+epoch >= currentHeight && height >= 1; height-- {
head = chain.GetHeaderByHash(head.ParentHash)
head = chain.GetHeader(head.ParentHash, head.Number.Uint64()-1)
if head == nil {
return true, fmt.Errorf("header is nil at height %d", height)
}
Expand All @@ -1088,7 +1088,7 @@ func (p *Parlia) distributeFinalityReward(chain consensus.ChainHeaderReader, sta
if voteAttestation == nil {
continue
}
justifiedBlock := chain.GetHeaderByHash(voteAttestation.Data.TargetHash)
justifiedBlock := chain.GetHeader(voteAttestation.Data.TargetHash, voteAttestation.Data.TargetNumber)
if justifiedBlock == nil {
p.logger.Warn("justifiedBlock is nil at height %d", voteAttestation.Data.TargetNumber)
continue
Expand Down

0 comments on commit be6a506

Please sign in to comment.