aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm_env.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-08-02 08:20:41 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-08-07 18:52:23 +0800
commit184e9ae9a81df2db6381e18d3daa035d913ae341 (patch)
tree1404780c9d9772b797ff979594e7468ca382d2b6 /core/vm_env.go
parent846f34f78b5f76233655d0cf3611706e99f2efe2 (diff)
downloaddexon-184e9ae9a81df2db6381e18d3daa035d913ae341.tar.gz
dexon-184e9ae9a81df2db6381e18d3daa035d913ae341.tar.zst
dexon-184e9ae9a81df2db6381e18d3daa035d913ae341.zip
core, tests: reduced state copy by N calls
Reduced the amount of state copied that are required by N calls by doing a balance check prior to any state modifications.
Diffstat (limited to 'core/vm_env.go')
-rw-r--r--core/vm_env.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/vm_env.go b/core/vm_env.go
index c1a86d63e..719829543 100644
--- a/core/vm_env.go
+++ b/core/vm_env.go
@@ -69,6 +69,10 @@ func (self *VMEnv) GetHash(n uint64) common.Hash {
func (self *VMEnv) AddLog(log *state.Log) {
self.state.AddLog(log)
}
+func (self *VMEnv) CanTransfer(from vm.Account, balance *big.Int) bool {
+ return from.Balance().Cmp(balance) >= 0
+}
+
func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error {
return vm.Transfer(from, to, amount)
}