Documentation ¶
Index ¶
- type Database
- type Delegate
- type DelegateDB
- func (d *DelegateDB) AddLog(log *types.Log)
- func (d *DelegateDB) AddVote(addr common.Address, amount *big.Int)
- func (d *DelegateDB) CommitTo(dbw trie.DatabaseWriter, deleteEmptyObjects bool) (root common.Hash, err error)
- func (d *DelegateDB) Copy() *DelegateDB
- func (d *DelegateDB) Dump() []byte
- func (d *DelegateDB) Error() error
- func (d *DelegateDB) Exist(addr common.Address) bool
- func (d *DelegateDB) Finalise(deleteEmptyObjects bool)
- func (d *DelegateDB) ForEachStorage(addr common.Address, cb func(key, value common.Hash) bool)
- func (d *DelegateDB) GetDelegates() []types.Candidate
- func (d *DelegateDB) GetLogs(hash common.Hash) []*types.Log
- func (d *DelegateDB) GetOrNewStateObject(addr common.Address, nickname string, registerTime uint64) *delegateObject
- func (d *DelegateDB) GetState(a common.Address, b common.Hash) common.Hash
- func (d *DelegateDB) GetStateObject(addr common.Address) (delegateObject *delegateObject)
- func (d *DelegateDB) GetVote(addr common.Address) *big.Int
- func (d *DelegateDB) HasSuicided(addr common.Address) bool
- func (d *DelegateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash
- func (d *DelegateDB) Logs() []*types.Log
- func (d *DelegateDB) MarkStateObjectDirty(addr common.Address)
- func (d *DelegateDB) Prepare(thash, bhash common.Hash, ti int)
- func (d *DelegateDB) RawDump() Dump
- func (d *DelegateDB) Reset(root common.Hash) error
- func (d *DelegateDB) RevertToSnapshot(revid int)
- func (d *DelegateDB) SetState(addr common.Address, key common.Hash, value common.Hash)
- func (d *DelegateDB) SetVote(addr common.Address, amount *big.Int)
- func (d *DelegateDB) Snapshot() int
- func (d *DelegateDB) SubExist(addr common.Address) bool
- func (d *DelegateDB) SubVote(addr common.Address, amount *big.Int)
- func (d *DelegateDB) Suicide(addr common.Address) bool
- type DelegateState
- type Dump
- type DumpDelegate
- type Storage
- type Trie
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface { // Accessing tries: // OpenTrie opens the main account trie. // OpenStorageTrie opens the storage trie of an account. OpenTrie(root common.Hash) (Trie, error) OpenStorageTrie(addrHash, root common.Hash) (Trie, error) // CopyTrie returns an independent copy of the given trie. CopyTrie(Trie) Trie }
func NewDatabase ¶
NewDatabase creates a backing store for state. The returned database is safe for concurrent use and retains cached trie nodes in memory.
type DelegateDB ¶
type DelegateDB struct {
// contains filtered or unexported fields
}
func New ¶
func New(root common.Hash, db Database) (*DelegateDB, error)
Create a new state from a given trie
func (*DelegateDB) AddLog ¶
func (d *DelegateDB) AddLog(log *types.Log)
func (*DelegateDB) CommitTo ¶
func (d *DelegateDB) CommitTo(dbw trie.DatabaseWriter, deleteEmptyObjects bool) (root common.Hash, err error)
CommitTo writes the state to the given database.
func (*DelegateDB) Copy ¶
func (d *DelegateDB) Copy() *DelegateDB
func (*DelegateDB) Dump ¶
func (d *DelegateDB) Dump() []byte
func (*DelegateDB) Error ¶
func (d *DelegateDB) Error() error
func (*DelegateDB) Exist ¶
func (d *DelegateDB) Exist(addr common.Address) bool
Exist reports whether the given account address exists in the state. Notably this also returns true for suicided accounts.
func (*DelegateDB) Finalise ¶
func (d *DelegateDB) Finalise(deleteEmptyObjects bool)
Finalise finalises the state by removing the self destructed objects and clears the journal as well as the refunds.
func (*DelegateDB) ForEachStorage ¶
func (*DelegateDB) GetDelegates ¶
func (d *DelegateDB) GetDelegates() []types.Candidate
get current sort delegates
func (*DelegateDB) GetOrNewStateObject ¶
func (d *DelegateDB) GetOrNewStateObject(addr common.Address, nickname string, registerTime uint64) *delegateObject
Retrieve a state object or create a new state object if nil
func (*DelegateDB) GetStateObject ¶
func (d *DelegateDB) GetStateObject(addr common.Address) (delegateObject *delegateObject)
Retrieve a state object given my the address. Returns nil if not found.
func (*DelegateDB) HasSuicided ¶
func (d *DelegateDB) HasSuicided(addr common.Address) bool
func (*DelegateDB) IntermediateRoot ¶
func (d *DelegateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash
func (*DelegateDB) Logs ¶
func (d *DelegateDB) Logs() []*types.Log
func (*DelegateDB) MarkStateObjectDirty ¶
func (d *DelegateDB) MarkStateObjectDirty(addr common.Address)
MarkStateObjectDirty adds the specified object to the dirty map to avoid costly state object cache iteration to find a handful of modified ones.
func (*DelegateDB) RawDump ¶
func (d *DelegateDB) RawDump() Dump
func (*DelegateDB) Reset ¶
func (d *DelegateDB) Reset(root common.Hash) error
Reset clears out all emphemeral state objects from the delegate db, but keeps the underlying state trie to avoid reloading data for the next operations.
func (*DelegateDB) RevertToSnapshot ¶
func (d *DelegateDB) RevertToSnapshot(revid int)
RevertToSnapshot reverts all state changes made since the given revision.
func (*DelegateDB) Snapshot ¶
func (d *DelegateDB) Snapshot() int
Snapshot returns an identifier for the current revision of the state.
type DelegateState ¶
type DelegateState interface { SubVote(addr common.Address, amount *big.Int) AddVote(addr common.Address, amount *big.Int) GetVote(addr common.Address) *big.Int GetState(common.Address, common.Hash) common.Hash SetState(common.Address, common.Hash, common.Hash) // Exist reports whether the given account exists in state. // Notably this should also return true for suicided accounts. Exist(common.Address) bool RevertToSnapshot(int) Snapshot() int AddLog(*types.Log) Suicide(common.Address) bool HasSuicided(common.Address) bool ForEachStorage(common.Address, func(common.Hash, common.Hash) bool) }
type Dump ¶
type Dump struct { Root string `json:"root"` Delegates map[string]DumpDelegate `json:"delegates"` }
type DumpDelegate ¶
type Trie ¶
type Trie interface { TryGet(key []byte) ([]byte, error) TryUpdate(key, value []byte) error TryDelete(key []byte) error CommitTo(trie.DatabaseWriter) (common.Hash, error) Hash() common.Hash NodeIterator(startKey []byte) trie.NodeIterator GetKey([]byte) []byte // TODO(fjl): remove this when SecureTrie is removed }
Trie is a eminer-pro Merkle Trie.