aboutsummaryrefslogtreecommitdiffstats
path: root/core/evm.go
diff options
context:
space:
mode:
authorBJ4 <bojie@dexon.org>2018-11-09 12:08:17 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:18 +0800
commit3911752697b6718fd8014146776378c465a8e88e (patch)
treeaddb109dae061bf4fdc8078522b1be2374c57f2b /core/evm.go
parentbfe8dc4f017f1fa3e6e2b0c370f7880ef847a7d4 (diff)
downloadgo-tangerine-3911752697b6718fd8014146776378c465a8e88e.tar
go-tangerine-3911752697b6718fd8014146776378c465a8e88e.tar.gz
go-tangerine-3911752697b6718fd8014146776378c465a8e88e.tar.bz2
go-tangerine-3911752697b6718fd8014146776378c465a8e88e.tar.lz
go-tangerine-3911752697b6718fd8014146776378c465a8e88e.tar.xz
go-tangerine-3911752697b6718fd8014146776378c465a8e88e.tar.zst
go-tangerine-3911752697b6718fd8014146776378c465a8e88e.zip
app: fix core test
Diffstat (limited to 'core/evm.go')
-rw-r--r--core/evm.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/evm.go b/core/evm.go
index 7e25e1d52..5e8cf9063 100644
--- a/core/evm.go
+++ b/core/evm.go
@@ -18,6 +18,7 @@ package core
import (
"math/big"
+ "reflect"
"sync"
"github.com/dexon-foundation/dexon/common"
@@ -48,6 +49,12 @@ func NewEVMContext(msg Message, header *types.Header, chain ChainContext, author
} else {
beneficiary = *author
}
+
+ var roundHeight sync.Map
+ if !reflect.ValueOf(chain).IsNil() {
+ roundHeight = chain.GetRoundHeightMap()
+ }
+
return vm.Context{
CanTransfer: CanTransfer,
Transfer: Transfer,
@@ -58,7 +65,7 @@ func NewEVMContext(msg Message, header *types.Header, chain ChainContext, author
Time: new(big.Int).SetUint64(header.Time),
Randomness: header.Randomness,
Difficulty: new(big.Int).Set(header.Difficulty),
- RoundHeight: chain.GetRoundHeightMap(),
+ RoundHeight: roundHeight,
GasLimit: header.GasLimit,
GasPrice: new(big.Int).Set(msg.GasPrice()),
}