From 184e9ae9a81df2db6381e18d3daa035d913ae341 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Sun, 2 Aug 2015 02:20:41 +0200 Subject: 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. --- core/vm_env.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core/vm_env.go') 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) } -- cgit