mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-25 13:07:17 +00:00
Merge pull request #3035 from Gustav-Simonsson/zero_value_transfer_noop
core/state: short-circuit balance change if zero value
This commit is contained in:
commit
e859f36967
@ -152,6 +152,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) {
|
||||||
@ -160,6 +163,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 New Issue
Block a user