aboutsummaryrefslogtreecommitdiffstats
path: root/core/evm.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-11-27 13:21:54 +0800
committerWei-Ning Huang <w@dexon.org>2018-12-19 20:54:27 +0800
commit283290ed6309a7681f1eafb628602513d4f3aee2 (patch)
tree4ca93879106dd87681ba08095d4b2da07ab1e60a /core/evm.go
parent9353a889cc34ba9999027b090d838b0deb90bc69 (diff)
downloaddexon-283290ed6309a7681f1eafb628602513d4f3aee2.tar
dexon-283290ed6309a7681f1eafb628602513d4f3aee2.tar.gz
dexon-283290ed6309a7681f1eafb628602513d4f3aee2.tar.bz2
dexon-283290ed6309a7681f1eafb628602513d4f3aee2.tar.lz
dexon-283290ed6309a7681f1eafb628602513d4f3aee2.tar.xz
dexon-283290ed6309a7681f1eafb628602513d4f3aee2.tar.zst
dexon-283290ed6309a7681f1eafb628602513d4f3aee2.zip
tests: fix tests
Diffstat (limited to 'core/evm.go')
-rw-r--r--core/evm.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/core/evm.go b/core/evm.go
index 87185abb8..9e4f00f7c 100644
--- a/core/evm.go
+++ b/core/evm.go
@@ -60,7 +60,7 @@ func NewEVMContext(msg Message, header *types.Header, chain ChainContext, author
Transfer: Transfer,
GetHash: GetHashFn(header, chain),
StateAtNumber: StateAtNumberFn(chain),
- GetRoundHeight: chain.GetRoundHeight,
+ GetRoundHeight: GetRoundHeightFn(chain),
Origin: msg.From(),
Coinbase: beneficiary,
BlockNumber: new(big.Int).Set(header.Number),
@@ -81,6 +81,15 @@ func StateAtNumberFn(chain ChainContext) func(n uint64) (*state.StateDB, error)
}
}
+func GetRoundHeightFn(chain ChainContext) func(uint64) (uint64, bool) {
+ if chain != nil {
+ return chain.GetRoundHeight
+ }
+ return func(uint64) (uint64, bool) {
+ return 0, false
+ }
+}
+
// GetHashFn returns a GetHashFunc which retrieves header hashes by number
func GetHashFn(ref *types.Header, chain ChainContext) func(n uint64) common.Hash {
var cache map[uint64]common.Hash