Documentation ¶
Index ¶
- Variables
- type Database
- type DevoteCache
- func (self *DevoteCache) CommitCycleTrie(db Database, root common.Hash) error
- func (self *DevoteCache) CommitStatsTrie(db Database, root common.Hash) error
- func (self *DevoteCache) Finalise()
- func (self *DevoteCache) GetWitnesses(db Database, cycle uint64) ([]string, error)
- func (self *DevoteCache) Hash() (h common.Hash)
- func (self *DevoteCache) Rolling(db Database, parentBlockTime, currentBlockTime uint64, witness string) (Trie, error)
- func (self *DevoteCache) SetWitnesses(cycle uint64, witnesses []string) error
- type DevoteDB
- func (d *DevoteDB) Commit() (*DevoteProtocol, error)
- func (d *DevoteDB) Copy() *DevoteDB
- func (db *DevoteDB) Database() Database
- func (d *DevoteDB) Exists() bool
- func (d *DevoteDB) GetCycle() uint64
- func (d *DevoteDB) GetStatsNumber(key []byte) uint64
- func (d *DevoteDB) GetWitnesses(cycle uint64) ([]string, error)
- func (d *DevoteDB) Protocol() *DevoteProtocol
- func (d *DevoteDB) RevertToSnapShot(snapshot *DevoteDB)
- func (d *DevoteDB) Rolling(parentBlockTime, currentBlockTime uint64, witness string)
- func (db *DevoteDB) Root() (h common.Hash)
- func (d *DevoteDB) SetCycle(cycle uint64)
- func (d *DevoteDB) SetCycleTrie(trie Trie)
- func (d *DevoteDB) SetStatsTrie(trie Trie)
- func (d *DevoteDB) SetWitnesses(cycle uint64, witnesses []string) error
- func (d *DevoteDB) Snapshot() *DevoteDB
- func (self *DevoteDB) StorageCycleTrie(hash common.Hash) Trie
- func (self *DevoteDB) StorageStatsTrie(hash common.Hash) Trie
- type DevoteProtocol
- type Trie
Constants ¶
This section is empty.
Variables ¶
var MaxTrieCacheGen = uint16(120)
Trie cache generation limit after which to evict trie nodes from memory.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface { // OpenTrie opens the main account trie. OpenTrie(root common.Hash) (Trie, error) // OpenStorageTrie opens the storage trie of an account. OpenStorageTrie(addrHash, root common.Hash) (Trie, error) // CopyTrie returns an independent copy of the given trie. CopyTrie(Trie) Trie // ContractCode retrieves a particular contract's code. ContractCode(addrHash, codeHash common.Hash) ([]byte, error) // ContractCodeSize retrieves a particular contracts code's size. ContractCodeSize(addrHash, codeHash common.Hash) (int, error) // TrieDB retrieves the low level trie database used for data storage. TrieDB() *trie.Database }
Database wraps access to tries and contract code.
func NewDatabase ¶
NewDatabase creates a backing store for state. The returned database is safe for concurrent use and retains cached trie nodes in memory. The pool is an optional intermediate trie-node memory pool between the low level storage layer and the high level trie abstraction.
type DevoteCache ¶
type DevoteCache struct {
// contains filtered or unexported fields
}
func (*DevoteCache) CommitCycleTrie ¶
func (self *DevoteCache) CommitCycleTrie(db Database, root common.Hash) error
func (*DevoteCache) CommitStatsTrie ¶
func (self *DevoteCache) CommitStatsTrie(db Database, root common.Hash) error
func (*DevoteCache) Finalise ¶
func (self *DevoteCache) Finalise()
Finalise finalises the state by removing the self destructed objects and clears the journal as well as the refunds.
func (*DevoteCache) GetWitnesses ¶
func (self *DevoteCache) GetWitnesses(db Database, cycle uint64) ([]string, error)
func (*DevoteCache) Hash ¶
func (self *DevoteCache) Hash() (h common.Hash)
func (*DevoteCache) Rolling ¶
func (self *DevoteCache) Rolling(db Database, parentBlockTime, currentBlockTime uint64, witness string) (Trie, error)
update counts in MinerRollingTrie for the miner of newBlock
func (*DevoteCache) SetWitnesses ¶
func (self *DevoteCache) SetWitnesses(cycle uint64, witnesses []string) error
type DevoteDB ¶
type DevoteDB struct {
// contains filtered or unexported fields
}
func NewDevoteByProtocol ¶
func NewDevoteByProtocol(db Database, protocol *DevoteProtocol) (*DevoteDB, error)
func (*DevoteDB) Commit ¶
func (d *DevoteDB) Commit() (*DevoteProtocol, error)
func (*DevoteDB) Exists ¶
Exist reports whether the given Devote hash exists in the state. Notably this also returns true for suicided Devotes.
func (*DevoteDB) GetStatsNumber ¶
func (*DevoteDB) Protocol ¶
func (d *DevoteDB) Protocol() *DevoteProtocol
func (*DevoteDB) RevertToSnapShot ¶
func (*DevoteDB) SetCycleTrie ¶
func (*DevoteDB) SetStatsTrie ¶
func (*DevoteDB) SetWitnesses ¶
func (*DevoteDB) StorageCycleTrie ¶
StorageTrie returns the storage trie of an account. The return value is a copy and is nil for non-existent accounts.
type DevoteProtocol ¶
type DevoteProtocol struct { CycleHash common.Hash `json:"cyclehash" gencodec:"required"` StatsHash common.Hash `json:"statshash" gencodec:"required"` // contains filtered or unexported fields }
func (*DevoteProtocol) Root ¶
func (d *DevoteProtocol) Root() (h common.Hash)
type Trie ¶
type Trie interface { TryGet(key []byte) ([]byte, error) TryUpdate(key, value []byte) error TryDelete(key []byte) error Commit(onleaf trie.LeafCallback) (common.Hash, error) Hash() common.Hash NodeIterator(startKey []byte) trie.NodeIterator GetKey([]byte) []byte // TODO(fjl): remove this when SecureTrie is removed Prove(key []byte, fromLevel uint, proofDb ethdb.Putter) error }
Trie is a Ethereum Merkle Trie.