mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 07:58:22 -05:00
use roughtime (#3366)
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user