aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-11-27 13:21:54 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:19 +0800
commit6267003986c9956359856b5f4e37304375b87411 (patch)
tree974bcaf029176eaea8282556cdac57e9bff9c949 /core
parent914b8f922685a62ed8177c8ffff0821ab1a34eee (diff)
downloadgo-tangerine-6267003986c9956359856b5f4e37304375b87411.tar.gz
go-tangerine-6267003986c9956359856b5f4e37304375b87411.tar.zst
go-tangerine-6267003986c9956359856b5f4e37304375b87411.zip
tests: fix tests
Diffstat (limited to 'core')
-rw-r--r--core/evm.go11
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