MCPcopy Create free account
hub / github.com/CPChain/chain / createObject

Method createObject

core/state/statedb.go:403–414  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
403func (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.

Callers 2

GetOrNewStateObjectMethod · 0.95
CreateAccountMethod · 0.95

Calls 5

getStateObjectMethod · 0.95
setStateObjectMethod · 0.95
newObjectFunction · 0.85
setNonceMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected