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

Method CreateAccount

core/state/statedb.go:426–431  ·  view source on GitHub ↗

CreateAccount explicitly creates a state object. If a state object with the address already exists the balance is carried over to the new account. CreateAccount is called during the EVM CREATE operation. The situation might arise that a contract does the following: 1. sends funds to sha(account ++

(addr common.Address)

Source from the content-addressed store, hash-verified

424//
425// Carrying over the balance ensures that Ether doesn't disappear.
426func (self *StateDB) CreateAccount(addr common.Address) {
427 new, prev := self.createObject(addr)
428 if prev != nil {
429 new.setBalance(prev.data.Balance)
430 }
431}
432
433func (db *StateDB) ForEachStorage(addr common.Address, cb func(key, value common.Hash) bool) {
434 so := db.getStateObject(addr)

Callers

nothing calls this directly

Calls 2

createObjectMethod · 0.95
setBalanceMethod · 0.80

Tested by

no test coverage detected