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@dexon.org>2019-03-12 12:19:09 +0800
commitf28fece79933816d1eed57b758d211760639cb58 (patch)
tree307c7be454e9a9be95076cda49bfaab7be308406 /core/evm.go
parentdbdc956478df94d63af69c28a17e63ecae1235aa (diff)
downloaddexon-f28fece79933816d1eed57b758d211760639cb58.tar.gz
dexon-f28fece79933816d1eed57b758d211760639cb58.tar.zst
dexon-f28fece79933816d1eed57b758d211760639cb58.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 d9ba7921c..bae09c514 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).Set(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()),
}