aboutsummaryrefslogtreecommitdiffstats
path: root/core/evm.go
diff options
context:
space:
mode:
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()),
}