Using static object for zero balance
@@ -118,6 +118,8 @@ const (
ExDepositInfo
)
+var zeroBalance big.Int
+
type accountStore interface {
Get(k []byte) ([]byte, error)
}
@@ -507,7 +509,7 @@ func newAccountSnapshot(dbase db.Database) *accountSnapshotImpl {
return &accountSnapshotImpl{
accountData: accountData{
version: AccountVersion,
- balance: new(big.Int),
+ balance: &zeroBalance,
database: dbase,
},
}
@@ -784,7 +786,7 @@ func (s *accountStateImpl) Clear() {
accountData: accountData{
database: s.database,
version: AccountVersion,
- balance: new(big.Int),
+ balance: &zeroBalance,
},
}
}
@@ -879,7 +881,7 @@ func newAccountState(database db.Database, snapshot AccountSnapshot, key []byte,
}
} else {
s.version = AccountVersion
- s.balance = new(big.Int)
+ s.balance = &zeroBalance
}
return s
}
