use roughtime (#3366)

This commit is contained in:
Preston Van Loon
2019-08-30 15:51:15 -07:00
committed by GitHub
parent f131585041
commit 8e2dcb81ae
2 changed files with 3 additions and 2 deletions

View File

@@ -22,6 +22,7 @@ go_library(
"//proto/eth/v1alpha1:go_default_library",
"//shared/bytesutil:go_default_library",
"//shared/params:go_default_library",
"//shared/roughtime:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@com_github_prysmaticlabs_go_ssz//:go_default_library",

View File

@@ -4,7 +4,6 @@ import (
"bytes"
"context"
"fmt"
"time"
"github.com/pkg/errors"
"github.com/prysmaticlabs/go-ssz"
@@ -14,6 +13,7 @@ import (
ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/roughtime"
"go.opencensus.io/trace"
)
@@ -160,7 +160,7 @@ func (s *Store) verifyBlkFinalizedSlot(b *ethpb.BeaconBlock) error {
// verifyBlkSlotTime validates the input block slot is not from the future.
func verifyBlkSlotTime(gensisTime uint64, blkSlot uint64) error {
slotTime := gensisTime + blkSlot*params.BeaconConfig().SecondsPerSlot
currentTime := uint64(time.Now().Unix())
currentTime := uint64(roughtime.Now().Unix())
if slotTime > currentTime {
return fmt.Errorf("could not process block from the future, slot time %d > current time %d", slotTime, currentTime)
}