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-04-09 21:32:53 +0800
commit07da8c75d1a8f9557f73eff4d6cb74e4047ea7b8 (patch)
treee045d29c9b1b9cd074a51ba8ef9eebe9a7e8c15e /core/evm.go
parent39ccaa58fd25cac9d2f85823f2ea56cd65cb06b7 (diff)
downloaddexon-07da8c75d1a8f9557f73eff4d6cb74e4047ea7b8.tar
dexon-07da8c75d1a8f9557f73eff4d6cb74e4047ea7b8.tar.gz
dexon-07da8c75d1a8f9557f73eff4d6cb74e4047ea7b8.tar.bz2
dexon-07da8c75d1a8f9557f73eff4d6cb74e4047ea7b8.tar.lz
dexon-07da8c75d1a8f9557f73eff4d6cb74e4047ea7b8.tar.xz
dexon-07da8c75d1a8f9557f73eff4d6cb74e4047ea7b8.tar.zst
dexon-07da8c75d1a8f9557f73eff4d6cb74e4047ea7b8.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()),
}