From 14336500ee38c2bc0b61a7133335df593aba4a46 Mon Sep 17 00:00:00 2001 From: Wei-Ning Huang Date: Wed, 2 Oct 2019 13:44:20 +0800 Subject: build: ci: fix tests --- core/block_validator.go | 3 +-- core/evm.go | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'core') diff --git a/core/block_validator.go b/core/block_validator.go index 1bb6aafa2..b91981e33 100644 --- a/core/block_validator.go +++ b/core/block_validator.go @@ -111,8 +111,7 @@ func (v *BlockValidator) ValidateWitnessData(height uint64, blockHash common.Has } if b.Hash() != blockHash { - log.Error("invalid witness block %s vs %s", - b.Hash().String(), blockHash.String()) + log.Error("invalid witness block", "first", b.Hash().String(), "second", blockHash.String()) return consensus.ErrWitnessMismatch } return nil diff --git a/core/evm.go b/core/evm.go index 3a0c0e7f8..822859572 100644 --- a/core/evm.go +++ b/core/evm.go @@ -55,6 +55,11 @@ func NewEVMContext(msg Message, header *types.Header, chain ChainContext, author beneficiary = *author } + ts := header.Time + if !*legacyEvm { + ts /= 1000 + } + return vm.Context{ CanTransfer: CanTransfer, Transfer: Transfer, @@ -64,7 +69,7 @@ func NewEVMContext(msg Message, header *types.Header, chain ChainContext, author Origin: msg.From(), Coinbase: beneficiary, BlockNumber: new(big.Int).Set(header.Number), - Time: new(big.Int).SetUint64(header.Time / 1000), // seconds. + Time: new(big.Int).SetUint64(ts), Randomness: header.Randomness, Difficulty: new(big.Int).Set(header.Difficulty), Round: new(big.Int).SetUint64(header.Round), -- cgit v1.2.3