createObject creates a new state object. If there is an existing account with the given address, it is overwritten and returned as the second return value.
(addr common.Address)
| 401 | // createObject creates a new state object. If there is an existing account with |
| 402 | // the given address, it is overwritten and returned as the second return value. |
| 403 | func (self *StateDB) createObject(addr common.Address) (newobj, prev *stateObject) { |
| 404 | prev = self.getStateObject(addr) |
| 405 | newobj = newObject(self, addr, Account{}) |
| 406 | newobj.setNonce(0) // sets the object to dirty |
| 407 | if prev == nil { |
| 408 | self.journal.append(createObjectChange{account: &addr}) |
| 409 | } else { |
| 410 | self.journal.append(resetObjectChange{prev: prev}) |
| 411 | } |
| 412 | self.setStateObject(newobj) |
| 413 | return newobj, prev |
| 414 | } |
| 415 | |
| 416 | // CreateAccount explicitly creates a state object. If a state object with the address |
| 417 | // already exists the balance is carried over to the new account. |
no test coverage detected