stateObject represents an Ethereum account which is being modified. The usage pattern is as follows: First you need to obtain a state object. Account values can be accessed and modified through the object. Finally, call CommitTrie to write the modified storage trie into a database.
| 61 | // Account values can be accessed and modified through the object. |
| 62 | // Finally, call CommitTrie to write the modified storage trie into a database. |
| 63 | type stateObject struct { |
| 64 | address common.Address |
| 65 | addrHash common.Hash // hash of ethereum address of the account |
| 66 | data Account |
| 67 | db *StateDB |
| 68 | |
| 69 | // DB error. |
| 70 | // State objects are used by the consensus core and VM which are |
| 71 | // unable to deal with database-level errors. Any error that occurs |
| 72 | // during a database read is memoized here and will eventually be returned |
| 73 | // by StateDB.Commit. |
| 74 | dbErr error |
| 75 | |
| 76 | // Write caches. |
| 77 | trie Trie // storage trie, which becomes non-nil on first access |
| 78 | code Code // contract bytecode, which gets set when code is loaded |
| 79 | |
| 80 | cachedStorage Storage // Storage entry cache to avoid duplicate reads |
| 81 | dirtyStorage Storage // Storage entries that need to be flushed to disk |
| 82 | |
| 83 | // Cache flags. |
| 84 | // When an object is marked suicided it will be delete from the trie |
| 85 | // during the "update" phase of the state transition. |
| 86 | dirtyCode bool // true if the code was updated |
| 87 | suicided bool |
| 88 | deleted bool |
| 89 | } |
| 90 | |
| 91 | // empty returns whether the account is considered empty. |
| 92 | func (s *stateObject) empty() bool { |
nothing calls this directly
no outgoing calls
no test coverage detected