diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-11-27 13:21:54 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:54 +0800 |
commit | 39d08a8ae65a37adfb774fdbf6e0f6247e94bda5 (patch) | |
tree | 759533eca5a46cc5e03e736f674293ac2302e849 /core | |
parent | 0f595a79c871281c6a1bef2c9cafcf2e5e4105b9 (diff) | |
download | dexon-39d08a8ae65a37adfb774fdbf6e0f6247e94bda5.tar dexon-39d08a8ae65a37adfb774fdbf6e0f6247e94bda5.tar.gz dexon-39d08a8ae65a37adfb774fdbf6e0f6247e94bda5.tar.bz2 dexon-39d08a8ae65a37adfb774fdbf6e0f6247e94bda5.tar.lz dexon-39d08a8ae65a37adfb774fdbf6e0f6247e94bda5.tar.xz dexon-39d08a8ae65a37adfb774fdbf6e0f6247e94bda5.tar.zst dexon-39d08a8ae65a37adfb774fdbf6e0f6247e94bda5.zip |
tests: fix tests
Diffstat (limited to 'core')
-rw-r--r-- | core/evm.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/core/evm.go b/core/evm.go index 80b0eaa7a..04bc173f5 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 |