Documentation ¶
Index ¶
- Constants
- Variables
- func NewLedgerStore() (ILedgerStore, error)
- type ChainStore
- func (cs *ChainStore) AddHeaders(headers []Header, ledger *Ledger) error
- func (cs *ChainStore) BlockInCache(hash Uint256) bool
- func (cs *ChainStore) CheckBlockHistory(history map[uint32]Uint256) (uint32, bool)
- func (cs *ChainStore) Close()
- func (cs *ChainStore) ContainsUnspent(txid Uint256, index uint16) (bool, error)
- func (cs *ChainStore) GetAccount(programHash Uint160) (*account.AccountState, error)
- func (cs *ChainStore) GetAsset(hash Uint256) (*Asset, error)
- func (cs *ChainStore) GetAssets() map[Uint256]*Asset
- func (cs *ChainStore) GetBlock(hash Uint256) (*Block, error)
- func (cs *ChainStore) GetBlockHash(height uint32) (Uint256, error)
- func (cs *ChainStore) GetBlockHistory(startHeight, blockNum uint32) map[uint32]Uint256
- func (cs *ChainStore) GetBookKeeperList() ([]*crypto.PubKey, []*crypto.PubKey, error)
- func (cs *ChainStore) GetContract(codeHash Uint160) ([]byte, error)
- func (cs *ChainStore) GetCurrentBlockHash() Uint256
- func (cs *ChainStore) GetCurrentHeaderHash() Uint256
- func (cs *ChainStore) GetHeader(hash Uint256) (*Header, error)
- func (cs *ChainStore) GetHeaderHashByHeight(height uint32) Uint256
- func (cs *ChainStore) GetHeaderHeight() uint32
- func (cs *ChainStore) GetHeight() uint32
- func (cs *ChainStore) GetHeightByBlockHash(hash Uint256) (uint32, error)
- func (cs *ChainStore) GetPrepaidInfo(programHash Uint160) (*Fixed64, *Fixed64, error)
- func (cs *ChainStore) GetQuantityIssued(assetId Uint256) (Fixed64, error)
- func (cs *ChainStore) GetStorage(key []byte) ([]byte, error)
- func (cs *ChainStore) GetTransaction(hash Uint256) (*tx.Transaction, error)
- func (cs *ChainStore) GetUnspent(txid Uint256, index uint16) (*tx.TxnOutput, error)
- func (cs *ChainStore) GetUnspentByHeight(programHash Uint160, assetid Uint256, height uint32) ([]*tx.UTXOUnspent, error)
- func (cs *ChainStore) GetUnspentFromProgramHash(programHash Uint160, assetid Uint256) ([]*tx.UTXOUnspent, error)
- func (cs *ChainStore) GetUnspentsFromProgramHash(programHash Uint160) (map[Uint256][]*tx.UTXOUnspent, error)
- func (cs *ChainStore) GetVotingWeight(hash Uint160) (int, error)
- func (cs *ChainStore) InitLedgerStoreWithGenesisBlock(genesisBlock *Block, defaultBookKeeper []*crypto.PubKey) (uint32, error)
- func (cs *ChainStore) IsBlockInStore(hash Uint256) bool
- func (cs *ChainStore) IsDoubleSpend(tx *tx.Transaction) bool
- func (cs *ChainStore) IsTxHashDuplicate(txhash Uint256) bool
- func (cs *ChainStore) SaveAsset(assetId Uint256, asset *Asset) error
- func (cs *ChainStore) SaveBlock(b *Block, ledger *Ledger) error
- func (cs *ChainStore) SaveTransaction(tx *tx.Transaction, height uint32) error
- func (cs *ChainStore) UpdatePrepaidInfo(programHash Uint160, amount, rates Fixed64) error
- func (cs *ChainStore) UpdateWithdrawInfo(programHash Uint160, amount Fixed64) error
- type DataEntryPrefix
- type IIterator
- type IStore
- type Iterator
- type LevelDBStore
- func (self *LevelDBStore) BatchCommit() error
- func (self *LevelDBStore) BatchDelete(key []byte) error
- func (self *LevelDBStore) BatchPut(key []byte, value []byte) error
- func (self *LevelDBStore) Close() error
- func (self *LevelDBStore) Delete(key []byte) error
- func (self *LevelDBStore) Get(key []byte) ([]byte, error)
- func (self *LevelDBStore) NewBatch() error
- func (self *LevelDBStore) NewIterator(prefix []byte) IIterator
- func (self *LevelDBStore) Put(key []byte, value []byte) error
- type UTXOs
Constants ¶
View Source
const ( HeaderHashListCount = 2000 CleanCacheThreshold = 2 TaskChanCap = 4 )
View Source
const BITSPERKEY = 10
used to compute the size of bloom filter bits array . too small will lead to high false positive rate.
Variables ¶
View Source
var (
ErrDBNotFound = errors.New("leveldb: not found")
)
Functions ¶
func NewLedgerStore ¶
func NewLedgerStore() (ILedgerStore, error)
Types ¶
type ChainStore ¶
type ChainStore struct {
// contains filtered or unexported fields
}
func NewChainStore ¶
func NewChainStore(file string) (*ChainStore, error)
func (*ChainStore) AddHeaders ¶
func (cs *ChainStore) AddHeaders(headers []Header, ledger *Ledger) error
func (*ChainStore) BlockInCache ¶
func (cs *ChainStore) BlockInCache(hash Uint256) bool
func (*ChainStore) CheckBlockHistory ¶
func (cs *ChainStore) CheckBlockHistory(history map[uint32]Uint256) (uint32, bool)
func (*ChainStore) Close ¶
func (cs *ChainStore) Close()
func (*ChainStore) ContainsUnspent ¶
func (cs *ChainStore) ContainsUnspent(txid Uint256, index uint16) (bool, error)
func (*ChainStore) GetAccount ¶
func (cs *ChainStore) GetAccount(programHash Uint160) (*account.AccountState, error)
func (*ChainStore) GetAsset ¶
func (cs *ChainStore) GetAsset(hash Uint256) (*Asset, error)
func (*ChainStore) GetAssets ¶
func (cs *ChainStore) GetAssets() map[Uint256]*Asset
func (*ChainStore) GetBlock ¶
func (cs *ChainStore) GetBlock(hash Uint256) (*Block, error)
func (*ChainStore) GetBlockHash ¶
func (cs *ChainStore) GetBlockHash(height uint32) (Uint256, error)
func (*ChainStore) GetBlockHistory ¶
func (cs *ChainStore) GetBlockHistory(startHeight, blockNum uint32) map[uint32]Uint256
func (*ChainStore) GetBookKeeperList ¶
func (*ChainStore) GetContract ¶
func (cs *ChainStore) GetContract(codeHash Uint160) ([]byte, error)
func (*ChainStore) GetCurrentBlockHash ¶
func (cs *ChainStore) GetCurrentBlockHash() Uint256
func (*ChainStore) GetCurrentHeaderHash ¶
func (cs *ChainStore) GetCurrentHeaderHash() Uint256
func (*ChainStore) GetHeader ¶
func (cs *ChainStore) GetHeader(hash Uint256) (*Header, error)
func (*ChainStore) GetHeaderHashByHeight ¶
func (cs *ChainStore) GetHeaderHashByHeight(height uint32) Uint256
func (*ChainStore) GetHeaderHeight ¶
func (cs *ChainStore) GetHeaderHeight() uint32
func (*ChainStore) GetHeight ¶
func (cs *ChainStore) GetHeight() uint32
func (*ChainStore) GetHeightByBlockHash ¶
func (cs *ChainStore) GetHeightByBlockHash(hash Uint256) (uint32, error)
func (*ChainStore) GetPrepaidInfo ¶
func (cs *ChainStore) GetPrepaidInfo(programHash Uint160) (*Fixed64, *Fixed64, error)
func (*ChainStore) GetQuantityIssued ¶
func (cs *ChainStore) GetQuantityIssued(assetId Uint256) (Fixed64, error)
func (*ChainStore) GetStorage ¶
func (cs *ChainStore) GetStorage(key []byte) ([]byte, error)
func (*ChainStore) GetTransaction ¶
func (cs *ChainStore) GetTransaction(hash Uint256) (*tx.Transaction, error)
func (*ChainStore) GetUnspent ¶
func (cs *ChainStore) GetUnspent(txid Uint256, index uint16) (*tx.TxnOutput, error)
func (*ChainStore) GetUnspentByHeight ¶
func (cs *ChainStore) GetUnspentByHeight(programHash Uint160, assetid Uint256, height uint32) ([]*tx.UTXOUnspent, error)
func (*ChainStore) GetUnspentFromProgramHash ¶
func (cs *ChainStore) GetUnspentFromProgramHash(programHash Uint160, assetid Uint256) ([]*tx.UTXOUnspent, error)
func (*ChainStore) GetUnspentsFromProgramHash ¶
func (cs *ChainStore) GetUnspentsFromProgramHash(programHash Uint160) (map[Uint256][]*tx.UTXOUnspent, error)
func (*ChainStore) GetVotingWeight ¶
func (cs *ChainStore) GetVotingWeight(hash Uint160) (int, error)
TODO get node voting weight form DB
func (*ChainStore) InitLedgerStoreWithGenesisBlock ¶
func (cs *ChainStore) InitLedgerStoreWithGenesisBlock(genesisBlock *Block, defaultBookKeeper []*crypto.PubKey) (uint32, error)
func (*ChainStore) IsBlockInStore ¶
func (cs *ChainStore) IsBlockInStore(hash Uint256) bool
func (*ChainStore) IsDoubleSpend ¶
func (cs *ChainStore) IsDoubleSpend(tx *tx.Transaction) bool
func (*ChainStore) IsTxHashDuplicate ¶
func (cs *ChainStore) IsTxHashDuplicate(txhash Uint256) bool
func (*ChainStore) SaveAsset ¶
func (cs *ChainStore) SaveAsset(assetId Uint256, asset *Asset) error
func (*ChainStore) SaveBlock ¶
func (cs *ChainStore) SaveBlock(b *Block, ledger *Ledger) error
func (*ChainStore) SaveTransaction ¶
func (cs *ChainStore) SaveTransaction(tx *tx.Transaction, height uint32) error
func (*ChainStore) UpdatePrepaidInfo ¶
func (cs *ChainStore) UpdatePrepaidInfo(programHash Uint160, amount, rates Fixed64) error
func (*ChainStore) UpdateWithdrawInfo ¶
func (cs *ChainStore) UpdateWithdrawInfo(programHash Uint160, amount Fixed64) error
type DataEntryPrefix ¶
type DataEntryPrefix byte
const ( // DATA DATA_BlockHash DataEntryPrefix = 0x00 DATA_Header DataEntryPrefix = 0x01 DATA_Transaction DataEntryPrefix = 0x02 // INDEX IX_HeaderHashList DataEntryPrefix = 0x80 IX_Unspent DataEntryPrefix = 0x90 IX_Unspent_UTXO DataEntryPrefix = 0x91 // ASSET ST_Info DataEntryPrefix = 0xc0 ST_QuantityIssued DataEntryPrefix = 0xc1 ST_Contract DataEntryPrefix = 0xc2 ST_Storage DataEntryPrefix = 0xc3 ST_Account DataEntryPrefix = 0xc4 ST_Prepaid DataEntryPrefix = 0xc7 //SYSTEM SYS_CurrentBlock DataEntryPrefix = 0x40 SYS_CurrentBookKeeper DataEntryPrefix = 0x42 //CONFIG CFG_Version DataEntryPrefix = 0xf0 )
type IStore ¶
type LevelDBStore ¶
type LevelDBStore struct {
// contains filtered or unexported fields
}
func NewLevelDBStore ¶
func NewLevelDBStore(file string) (*LevelDBStore, error)
func (*LevelDBStore) BatchCommit ¶
func (self *LevelDBStore) BatchCommit() error
func (*LevelDBStore) BatchDelete ¶
func (self *LevelDBStore) BatchDelete(key []byte) error
func (*LevelDBStore) Close ¶
func (self *LevelDBStore) Close() error
func (*LevelDBStore) Delete ¶
func (self *LevelDBStore) Delete(key []byte) error
func (*LevelDBStore) NewBatch ¶
func (self *LevelDBStore) NewBatch() error
func (*LevelDBStore) NewIterator ¶
func (self *LevelDBStore) NewIterator(prefix []byte) IIterator
Click to show internal directories.
Click to hide internal directories.