Documentation ¶
Index ¶
- Constants
- Variables
- func GetInterestRate() (threeMonth, sixMonth, oneYear, moreOneYear uint64)
- func NewStakeStorage(store *StoreDB) *trieStakeStore
- func NewTrieAccoutStore(store *StoreDB) *trieAccountStore
- type Store
- func (s Store) AddBalance(addr *crypto.CommonAddress, height uint64, amount *big.Int) error
- func (s Store) AddCandidateAddr(addr *crypto.CommonAddress) error
- func (s Store) AliasExist(alias string) bool
- func (s Store) AliasGet(alias string) (*crypto.CommonAddress, error)
- func (s Store) AliasSet(addr *crypto.CommonAddress, alias string) (err error)
- func (s Store) CancelCandidateCredit(fromAddr *crypto.CommonAddress, cancelBalance *big.Int, height uint64) (*types.IntersetDetail, error)
- func (s Store) CancelVoteCredit(fromAddr, toAddr *crypto.CommonAddress, cancelBalance *big.Int, height uint64) (*types.IntersetDetail, error)
- func (s Store) CandidateCredit(fromAddr *crypto.CommonAddress, addBalance *big.Int, data []byte, ...) error
- func (s Store) Commit()
- func (s Store) CopyState() *database.SnapShot
- func (s Store) DeleteStorage(addr *crypto.CommonAddress) error
- func (s Store) Empty(addr *crypto.CommonAddress) bool
- func (s Store) Get(key []byte) ([]byte, error)
- func (s Store) GetBalance(addr *crypto.CommonAddress, height uint64) *big.Int
- func (s Store) GetByteCode(addr *crypto.CommonAddress) []byte
- func (s Store) GetCandidateAddrs() ([]crypto.CommonAddress, error)
- func (s Store) GetCandidateData(addr *crypto.CommonAddress) ([]byte, error)
- func (s Store) GetChangeInterval() (uint64, error)
- func (s Store) GetCodeHash(addr *crypto.CommonAddress) crypto.Hash
- func (s *Store) GetCreditDetails(addr *crypto.CommonAddress) map[crypto.CommonAddress]big.Int
- func (s Store) GetNonce(addr *crypto.CommonAddress) uint64
- func (s Store) GetReputation(addr *crypto.CommonAddress) *big.Int
- func (s Store) GetStateRoot() []byte
- func (s Store) GetStorageAlias(addr *crypto.CommonAddress) string
- func (s Store) GetVoteCreditCount(addr *crypto.CommonAddress) *big.Int
- func (s Store) Put(key []byte, value []byte) error
- func (s Store) PutBalance(addr *crypto.CommonAddress, height uint64, balance *big.Int) error
- func (s Store) PutByteCode(addr *crypto.CommonAddress, byteCode []byte) error
- func (s Store) PutNonce(addr *crypto.CommonAddress, nonce uint64) error
- func (s *Store) RecoverTrie(root []byte) bool
- func (s *Store) RevertState(shot *database.SnapShot)
- func (s Store) SubBalance(addr *crypto.CommonAddress, height uint64, amount *big.Int) error
- func (s Store) TrieDB() *trie.Database
- func (s Store) VoteCredit(fromAddr *crypto.CommonAddress, to *crypto.CommonAddress, addBalance *big.Int, ...) error
- type StoreDB
- func (s *StoreDB) CopyState() *database.SnapShot
- func (s *StoreDB) Delete(key []byte) error
- func (s *StoreDB) Flush()
- func (s *StoreDB) Get(key []byte) ([]byte, error)
- func (s *StoreDB) Put(key []byte, value []byte) error
- func (s *StoreDB) RecoverTrie(root []byte) bool
- func (s *StoreDB) RevertState(shot *database.SnapShot)
- type StoreInterface
Constants ¶
View Source
const ( AliasPrefix = "alias" AddressStorage = "AddressStorage" //以地址作为KEY的对象存储 )
View Source
const ( CandidateAddrs = "CandidateAddrs" //参与竞选出块节点的地址集合 StakeStorage = "StakeStorage" //以地址作为KEY,存储stake相关内容 )
View Source
const ( MODULENAME = "store" ChangeInterval = "changeInterval" )
Variables ¶
Functions ¶
func GetInterestRate ¶
func GetInterestRate() (threeMonth, sixMonth, oneYear, moreOneYear uint64)
Show interest rates in 3 months, 3-6 months, 6-12 months and more
func NewStakeStorage ¶
func NewStakeStorage(store *StoreDB) *trieStakeStore
func NewTrieAccoutStore ¶
func NewTrieAccoutStore(store *StoreDB) *trieAccountStore
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (Store) AddBalance ¶
func (Store) AddCandidateAddr ¶
func (s Store) AddCandidateAddr(addr *crypto.CommonAddress) error
func (Store) AliasExist ¶
func (Store) AliasSet ¶
func (s Store) AliasSet(addr *crypto.CommonAddress, alias string) (err error)
func (Store) CancelCandidateCredit ¶
func (s Store) CancelCandidateCredit(fromAddr *crypto.CommonAddress, cancelBalance *big.Int, height uint64) (*types.IntersetDetail, error)
func (Store) CancelVoteCredit ¶
func (s Store) CancelVoteCredit(fromAddr, toAddr *crypto.CommonAddress, cancelBalance *big.Int, height uint64) (*types.IntersetDetail, error)
func (Store) CandidateCredit ¶
func (Store) DeleteStorage ¶
func (s Store) DeleteStorage(addr *crypto.CommonAddress) error
func (Store) GetBalance ¶
func (Store) GetByteCode ¶
func (s Store) GetByteCode(addr *crypto.CommonAddress) []byte
func (Store) GetCandidateAddrs ¶
func (s Store) GetCandidateAddrs() ([]crypto.CommonAddress, error)
func (Store) GetCandidateData ¶
func (s Store) GetCandidateData(addr *crypto.CommonAddress) ([]byte, error)
func (Store) GetChangeInterval ¶
func (Store) GetCodeHash ¶
func (s Store) GetCodeHash(addr *crypto.CommonAddress) crypto.Hash
func (*Store) GetCreditDetails ¶
func (s *Store) GetCreditDetails(addr *crypto.CommonAddress) map[crypto.CommonAddress]big.Int
func (Store) GetReputation ¶
func (s Store) GetReputation(addr *crypto.CommonAddress) *big.Int
func (Store) GetStateRoot ¶
func (Store) GetStorageAlias ¶
func (s Store) GetStorageAlias(addr *crypto.CommonAddress) string
func (Store) GetVoteCreditCount ¶
func (s Store) GetVoteCreditCount(addr *crypto.CommonAddress) *big.Int
func (Store) PutBalance ¶
func (Store) PutByteCode ¶
func (s Store) PutByteCode(addr *crypto.CommonAddress, byteCode []byte) error
func (*Store) RecoverTrie ¶
func (*Store) RevertState ¶
func (Store) SubBalance ¶
func (Store) VoteCredit ¶
func (s Store) VoteCredit(fromAddr *crypto.CommonAddress, to *crypto.CommonAddress, addBalance *big.Int, height uint64) error
type StoreDB ¶
type StoreDB struct {
// contains filtered or unexported fields
}
func NewStoreDB ¶
func NewStoreDB(store dbinterface.KeyValueStore, cache *database.TransactionStore, trie *trie.SecureTrie, trieDb *trie.Database) *StoreDB
func (*StoreDB) RecoverTrie ¶
func (*StoreDB) RevertState ¶
type StoreInterface ¶
type StoreInterface interface { DeleteStorage(addr *crypto.CommonAddress) error GetStorageAlias(addr *crypto.CommonAddress) string AliasGet(alias string) (*crypto.CommonAddress, error) AliasExist(alias string) bool AliasSet(addr *crypto.CommonAddress, alias string) (err error) GetBalance(addr *crypto.CommonAddress, height uint64) *big.Int PutBalance(addr *crypto.CommonAddress, height uint64, balance *big.Int) error AddBalance(addr *crypto.CommonAddress, height uint64, amount *big.Int) error SubBalance(addr *crypto.CommonAddress, height uint64, amount *big.Int) error GetNonce(addr *crypto.CommonAddress) uint64 PutNonce(addr *crypto.CommonAddress, nonce uint64) error GetByteCode(addr *crypto.CommonAddress) []byte GetCodeHash(addr *crypto.CommonAddress) crypto.Hash PutByteCode(addr *crypto.CommonAddress, byteCode []byte) error GetReputation(addr *crypto.CommonAddress) *big.Int GetStateRoot() []byte RecoverTrie(root []byte) bool TrieDB() *trie.Database Get(key []byte) ([]byte, error) Put(key []byte, value []byte) error Commit() CopyState() *database.SnapShot RevertState(shot *database.SnapShot) Empty(addr *crypto.CommonAddress) bool GetChangeInterval() (uint64, error) //pos GetCandidateAddrs() ([]crypto.CommonAddress, error) GetVoteCreditCount(addr *crypto.CommonAddress) *big.Int CancelVoteCredit(fromAddr, toAddr *crypto.CommonAddress, cancelBalance *big.Int, height uint64) (*types.IntersetDetail, error) VoteCredit(addresses *crypto.CommonAddress, to *crypto.CommonAddress, addBalance *big.Int, height uint64) error CandidateCredit(addresses *crypto.CommonAddress, addBalance *big.Int, data []byte, height uint64) error CancelCandidateCredit(fromAddr *crypto.CommonAddress, cancelBalance *big.Int, height uint64) (*types.IntersetDetail, error) GetCandidateData(addr *crypto.CommonAddress) ([]byte, error) AddCandidateAddr(addr *crypto.CommonAddress) error }
func TrieStoreFromStore ¶
func TrieStoreFromStore(diskDB dbinterface.KeyValueStore, stateRoot []byte) (StoreInterface, error)
Click to show internal directories.
Click to hide internal directories.