Documentation ¶
Index ¶
- Constants
- Variables
- func GetInterestRate() (threeMonth, sixMonth, oneYear, moreOneYear uint64)
- type ChainStore
- func (chainStore *ChainStore) BlockNodeCount() int64
- func (chainStore *ChainStore) BlockNodeIterator(handle func(*types.BlockHeader, types.BlockStatus) error) error
- func (chainStore *ChainStore) DeleteReceipts(blockHash crypto.Hash) error
- func (chainStore *ChainStore) GetBlock(hash *crypto.Hash) (*types.Block, error)
- func (chainStore *ChainStore) GetBlockHeader(hash *crypto.Hash) (*types.BlockHeader, error)
- func (chainStore *ChainStore) GetBlockNode(hash *crypto.Hash, height uint64) (*types.BlockHeader, types.BlockStatus, error)
- func (chainStore *ChainStore) GetReceipt(txHash crypto.Hash) *types.Receipt
- func (chainStore *ChainStore) GetReceipts(blockHash crypto.Hash) []*types.Receipt
- func (chainStore *ChainStore) HasBlock(hash *crypto.Hash) bool
- func (chainStore *ChainStore) PutBlock(block *types.Block) error
- func (chainStore *ChainStore) PutBlockNode(blockNode *types.BlockNode) error
- func (chainStore *ChainStore) PutReceipt(txHash crypto.Hash, receipt *types.Receipt) error
- func (chainStore *ChainStore) PutReceipts(blockHash crypto.Hash, receipts []*types.Receipt) error
- func (chainStore *ChainStore) RollBack(height uint64, hash *crypto.Hash) (error, int64)
- 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, height uint64) (err error)
- func (s Store) CancelCandidateCredit(fromAddr *crypto.CommonAddress, cancelBalance *big.Int, height uint64) (*types.CancelCreditDetail, error)
- func (s Store) CancelVoteCredit(fromAddr, toAddr *crypto.CommonAddress, cancelBalance *big.Int, height uint64) (*types.CancelCreditDetail, 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 storage alias used prefix AliasPrefix = "alias" //AddressStorage Object stored with the address as the KEY AddressStorage = "AddressStorage" )
View Source
const ( //CandidateAddrs Participates in the selection of the address set of block nodes CandidateAddrs = "CandidateAddrs" //StakeStorage With the address as the KEY, the relevant content is stored StakeStorage = "StakeStorage" RegisterPledgeLimit uint64 = 50000000 //The candidate node needs the total number of collateral COINS, unit 1drep )
View Source
const ( MODULENAME = "store" ChangeInterval = "changeInterval" )
Variables ¶
View Source
var ( //ErrRecoverRoot recover root err ErrRecoverRoot = errors.New("fail to recover root state") //ErrUsedAlias the alias has been used ErrUsedAlias = errors.New("the alias has been used") //ErrInvalidateAlias set null string as alias ErrInvalidateAlias = errors.New("set null string as alias") )
View Source
var ( MetaDataPrefix = []byte("metaData_") ChainStatePrefix = []byte("chainState_") BlockPrefix = []byte("block_") BlockNodePrefix = []byte("blockNode_") )
Functions ¶
func GetInterestRate ¶
func GetInterestRate() (threeMonth, sixMonth, oneYear, moreOneYear uint64)
Show interest rates in 3 months, 3-6 months, 6-12 months and more
Types ¶
type ChainStore ¶
type ChainStore struct {
dbinterface.KeyValueStore
}
func (*ChainStore) BlockNodeCount ¶
func (chainStore *ChainStore) BlockNodeCount() int64
func (*ChainStore) BlockNodeIterator ¶
func (chainStore *ChainStore) BlockNodeIterator(handle func(*types.BlockHeader, types.BlockStatus) error) error
func (*ChainStore) DeleteReceipts ¶
func (chainStore *ChainStore) DeleteReceipts(blockHash crypto.Hash) error
func (*ChainStore) GetBlockHeader ¶
func (chainStore *ChainStore) GetBlockHeader(hash *crypto.Hash) (*types.BlockHeader, error)
func (*ChainStore) GetBlockNode ¶
func (chainStore *ChainStore) GetBlockNode(hash *crypto.Hash, height uint64) (*types.BlockHeader, types.BlockStatus, error)
func (*ChainStore) GetReceipt ¶
func (chainStore *ChainStore) GetReceipt(txHash crypto.Hash) *types.Receipt
func (*ChainStore) GetReceipts ¶
func (chainStore *ChainStore) GetReceipts(blockHash crypto.Hash) []*types.Receipt
func (*ChainStore) PutBlockNode ¶
func (chainStore *ChainStore) PutBlockNode(blockNode *types.BlockNode) error
func (*ChainStore) PutReceipt ¶
func (*ChainStore) PutReceipts ¶
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) CancelCandidateCredit ¶
func (s Store) CancelCandidateCredit(fromAddr *crypto.CommonAddress, cancelBalance *big.Int, height uint64) (*types.CancelCreditDetail, error)
func (Store) CancelVoteCredit ¶
func (s Store) CancelVoteCredit(fromAddr, toAddr *crypto.CommonAddress, cancelBalance *big.Int, height uint64) (*types.CancelCreditDetail, 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, height uint64) (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.CancelCreditDetail, 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.CancelCreditDetail, error) GetCandidateData(addr *crypto.CommonAddress) ([]byte, error) AddCandidateAddr(addr *crypto.CommonAddress) error GetCreditDetails(addr *crypto.CommonAddress) map[crypto.CommonAddress]big.Int }
func TrieStoreFromStore ¶
func TrieStoreFromStore(diskDB dbinterface.KeyValueStore, stateRoot []byte) (StoreInterface, error)
Click to show internal directories.
Click to hide internal directories.