From 25ed5feddadea8201974bfacb2a57d060b697acb Mon Sep 17 00:00:00 2001 From: Gustav Simonsson Date: Mon, 26 Sep 2016 01:25:50 -0400 Subject: core/state: short-circuit balance change if zero value --- core/state/state_object.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'core/state') diff --git a/core/state/state_object.go b/core/state/state_object.go index c5462316d..9f0ce5b4b 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -152,6 +152,9 @@ func (self *StateObject) Update() { } func (c *StateObject) AddBalance(amount *big.Int) { + if amount.Cmp(common.Big0) == 0 { + return + } c.SetBalance(new(big.Int).Add(c.balance, amount)) if glog.V(logger.Core) { @@ -160,6 +163,9 @@ func (c *StateObject) AddBalance(amount *big.Int) { } func (c *StateObject) SubBalance(amount *big.Int) { + if amount.Cmp(common.Big0) == 0 { + return + } c.SetBalance(new(big.Int).Sub(c.balance, amount)) if glog.V(logger.Core) { -- cgit v1.2.3