Documentation
¶
Overview ¶
Package state provides a caching layer atop the Ethereum state trie.
Index ¶
- func NewDatabase(db ethdb.Database) ethstate.Database
- func NewDatabaseWithConfig(db ethdb.Database, config *triedb.Config) ethstate.Database
- func NewDatabaseWithNodeDB(db ethdb.Database, triedb *triedb.Database) ethstate.Database
- func NormalizeCoinID(coinID *common.Hash)
- func NormalizeStateKey(key *common.Hash)
- func WithConcurrentWorkers(prefetchers int) ethstate.PrefetcherOption
- type Database
- type Dump
- type DumpAccount
- type DumpCollector
- type DumpConfig
- type StateDB
- func (s *StateDB) AddBalanceMultiCoin(addr common.Address, coinID common.Hash, amount *big.Int)
- func (s *StateDB) Copy() *StateDB
- func (s *StateDB) GetBalanceMultiCoin(addr common.Address, coinID common.Hash) *big.Int
- func (s *StateDB) GetState(addr common.Address, hash common.Hash) common.Hash
- func (s *StateDB) GetTxHash() common.Hash
- func (s *StateDB) SetState(addr common.Address, key, value common.Hash)
- func (s *StateDB) SetTxContext(thash common.Hash, ti int)
- func (s *StateDB) SubBalanceMultiCoin(addr common.Address, coinID common.Hash, amount *big.Int)
- type Trie
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDatabaseWithConfig ¶ added in v0.5.0
func NewDatabaseWithNodeDB ¶ added in v0.12.3
func NormalizeCoinID ¶
NormalizeCoinID ORs the 0th bit of the first byte in `coinID`, which ensures this bit will be 1 and all other bits are left the same. This partitions multicoin storage from normal state storage.
func NormalizeStateKey ¶
NormalizeStateKey ANDs the 0th bit of the first byte in `key`, which ensures this bit will be 0 and all other bits are left the same. This partitions normal state storage from multicoin storage.
func WithConcurrentWorkers ¶ added in v0.15.0
func WithConcurrentWorkers(prefetchers int) ethstate.PrefetcherOption
Types ¶
type DumpAccount ¶
type DumpAccount = ethstate.DumpAccount
type DumpCollector ¶ added in v0.3.1
type DumpCollector = ethstate.DumpCollector
type DumpConfig ¶ added in v0.6.0
type DumpConfig = ethstate.DumpConfig
type StateDB ¶
StateDB structs within the ethereum protocol are used to store anything within the merkle trie. StateDBs take care of caching and storing nested states. It's the general query interface to retrieve:
* Contracts * Accounts
Once the state is committed, tries cached in stateDB (including account trie, storage tries) will no longer be functional. A new state instance must be created with new root and updated database for accessing post- commit states.
func (*StateDB) AddBalanceMultiCoin ¶
AddBalance adds amount to the account associated with addr.
func (*StateDB) GetBalanceMultiCoin ¶
Retrieve the balance from the given address or 0 if object not found
func (*StateDB) GetTxHash ¶ added in v0.12.10
GetTxHash returns the current tx hash on the StateDB set by SetTxContext.
func (*StateDB) SetTxContext ¶ added in v0.12.3
SetTxContext sets the current transaction hash and index which are used when the EVM emits new state logs. It should be invoked before transaction execution.