mirror of
https://github.com/arnaucube/go-ethereum.git
synced 2026-02-28 05:56:45 +01:00
core/state: short-circuit balance change if zero value
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user