core/state: fixed some comments (#21450)

This commit is contained in:
Giuseppe Bertone
2020-08-19 08:54:21 +02:00
committed by GitHub
parent f3bafecef7
commit 2ff464b29d
3 changed files with 14 additions and 15 deletions

View File

@ -375,22 +375,21 @@ func (s *stateObject) CommitTrie(db Database) error {
return err
}
// AddBalance removes amount from c's balance.
// AddBalance adds amount to s's balance.
// It is used to add funds to the destination account of a transfer.
func (s *stateObject) AddBalance(amount *big.Int) {
// EIP158: We must check emptiness for the objects such that the account
// EIP161: We must check emptiness for the objects such that the account
// clearing (0,0,0 objects) can take effect.
if amount.Sign() == 0 {
if s.empty() {
s.touch()
}
return
}
s.SetBalance(new(big.Int).Add(s.Balance(), amount))
}
// SubBalance removes amount from c's balance.
// SubBalance removes amount from s's balance.
// It is used to remove funds from the origin account of a transfer.
func (s *stateObject) SubBalance(amount *big.Int) {
if amount.Sign() == 0 {
@ -455,7 +454,7 @@ func (s *stateObject) Code(db Database) []byte {
}
// CodeSize returns the size of the contract code associated with this object,
// or zero if none. This methos is an almost mirror of Code, but uses a cache
// or zero if none. This method is an almost mirror of Code, but uses a cache
// inside the database to avoid loading codes seen recently.
func (s *stateObject) CodeSize(db Database) int {
if s.code != nil {