Skip to content

Commit

Permalink
fix heco inturn logic (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiangxu authored Mar 26, 2021
1 parent cf89694 commit f636229
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions native/service/header_sync/heco/header_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,23 +263,12 @@ func (h *Handler) SyncBlockHeader(native *native.NativeService) error {
}

// get prev epochs, also checking recent limit
phv, pphv, lastSeenHeight, err := getPrevHeightAndValidators(native, &header, ctx)
phv, _, lastSeenHeight, err := getPrevHeightAndValidators(native, &header, ctx)
if err != nil {
return fmt.Errorf("heco Handler SyncBlockHeader, getPrevHeightAndValidators err: %v", err)
}

var (
inTurnHV *HeightAndValidators
)

diffWithLastEpoch := big.NewInt(0).Sub(header.Number, phv.Height).Int64()
if diffWithLastEpoch <= int64(len(pphv.Validators)/2) {
// pphv is in effect
inTurnHV = pphv
} else {
// phv is in effect
inTurnHV = phv
}
inTurnHV := phv

if lastSeenHeight > 0 {
limit := int64(len(inTurnHV.Validators) / 2)
Expand Down

0 comments on commit f636229

Please sign in to comment.