mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-01 13:52:54 +00:00
[release 1.4.12] core: short-circuit balance change if zero value
(cherry picked from commit 25ed5fedda)
This commit is contained in:
parent
dfc63c49c7
commit
42e4e18667
1 changed files with 6 additions and 0 deletions
|
|
@ -154,6 +154,9 @@ func (self *StateObject) Update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *StateObject) AddBalance(amount *big.Int) {
|
func (c *StateObject) AddBalance(amount *big.Int) {
|
||||||
|
if amount.Cmp(common.Big0) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
c.SetBalance(new(big.Int).Add(c.balance, amount))
|
c.SetBalance(new(big.Int).Add(c.balance, amount))
|
||||||
|
|
||||||
if glog.V(logger.Core) {
|
if glog.V(logger.Core) {
|
||||||
|
|
@ -162,6 +165,9 @@ func (c *StateObject) AddBalance(amount *big.Int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *StateObject) SubBalance(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))
|
c.SetBalance(new(big.Int).Sub(c.balance, amount))
|
||||||
|
|
||||||
if glog.V(logger.Core) {
|
if glog.V(logger.Core) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue