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. --- cmd/evm/main.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cmd') diff --git a/cmd/evm/main.go b/cmd/evm/main.go index 7dd375b14..be6546c95 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -206,6 +206,9 @@ func (self *VMEnv) StructLogs() []vm.StructLog { 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 v1.2.3