From f636229340b49dc685c33053a8c725d36206a7bc Mon Sep 17 00:00:00 2001 From: zhiqiangxu <652732310@qq.com> Date: Fri, 26 Mar 2021 14:35:33 +0800 Subject: [PATCH] fix heco inturn logic (#43) --- native/service/header_sync/heco/header_sync.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/native/service/header_sync/heco/header_sync.go b/native/service/header_sync/heco/header_sync.go index d9abdbaf2..28e6487db 100644 --- a/native/service/header_sync/heco/header_sync.go +++ b/native/service/header_sync/heco/header_sync.go @@ -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)