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

Function newObject

core/state/state_object.go:106–121  ·  view source on GitHub ↗

newObject creates a state object.

(db *StateDB, address common.Address, data Account)

Source from the content-addressed store, hash-verified

104
105// newObject creates a state object.
106func newObject(db *StateDB, address common.Address, data Account) *stateObject {
107 if data.Balance == nil {
108 data.Balance = new(big.Int)
109 }
110 if data.CodeHash == nil {
111 data.CodeHash = emptyCodeHash
112 }
113 return &stateObject{
114 db: db,
115 address: address,
116 addrHash: crypto.Keccak256Hash(address[:]),
117 data: data,
118 cachedStorage: make(Storage),
119 dirtyStorage: make(Storage),
120 }
121}
122
123// EncodeRLP implements rlp.Encoder.
124func (c *stateObject) EncodeRLP(w io.Writer) error {

Callers 4

deepCopyMethod · 0.85
getStateObjectMethod · 0.85
createObjectMethod · 0.85
RawDumpMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected