ChainStore

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2019 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderHashListCount = 2000
	CleanCacheThreshold = 2
	TaskChanCap         = 4
	DEPLOY_TRANSACTION  = "DeployTransaction"
	INVOKE_TRANSACTION  = "InvokeTransaction"
)

Variables

View Source
var (
	ErrDBNotFound = errors.New("leveldb: not found")
)

Functions

func NewLedgerStore

func NewLedgerStore() (ILedgerStore, error)

func NewStore

func NewStore(file string) (IStore, error)

Types

type CacheCodeTable

type CacheCodeTable struct {
	// contains filtered or unexported fields
}

func NewCacheCodeTable

func NewCacheCodeTable(dbCache *DBCache) *CacheCodeTable

func (*CacheCodeTable) GetCode

func (table *CacheCodeTable) GetCode(codeHash []byte) ([]byte, error)

type ChainStore

type ChainStore struct {
	// contains filtered or unexported fields
}

func NewChainStore

func NewChainStore(file string) (*ChainStore, error)

func (*ChainStore) AddHeaders

func (self *ChainStore) AddHeaders(headers []Header, ledger *Ledger) error

func (*ChainStore) BlockInCache

func (bd *ChainStore) BlockInCache(hash Uint256) bool

func (*ChainStore) Close

func (self *ChainStore) Close()

func (*ChainStore) ContainsUnspent

func (bd *ChainStore) ContainsUnspent(txid Uint256, index uint16) (bool, error)

func (*ChainStore) GetAccount

func (bd *ChainStore) GetAccount(programHash Uint160) (*account.AccountState, error)

func (*ChainStore) GetAsset

func (bd *ChainStore) GetAsset(hash Uint256) (*Asset, error)

func (*ChainStore) GetAssetState

func (bd *ChainStore) GetAssetState(assetId Uint256) (*states.AssetState, error)

func (*ChainStore) GetAssets

func (bd *ChainStore) GetAssets() map[Uint256]*Asset

func (*ChainStore) GetAvailableAsset

func (bd *ChainStore) GetAvailableAsset(programHash Uint160, assetID Uint256) (Fixed64, Fixed64, error)

func (*ChainStore) GetBlock

func (bd *ChainStore) GetBlock(hash Uint256) (*Block, error)

func (*ChainStore) GetBlockHash

func (bd *ChainStore) GetBlockHash(height uint32) (Uint256, error)

func (*ChainStore) GetBookKeeperList

func (self *ChainStore) GetBookKeeperList() ([]*crypto.PubKey, []*crypto.PubKey, error)

func (*ChainStore) GetContract

func (bd *ChainStore) GetContract(codeHash Uint160) ([]byte, error)

func (*ChainStore) GetCurrentBlockHash

func (bd *ChainStore) GetCurrentBlockHash() Uint256

func (*ChainStore) GetCurrentHeaderHash

func (bd *ChainStore) GetCurrentHeaderHash() Uint256

func (*ChainStore) GetHeader

func (bd *ChainStore) GetHeader(hash Uint256) (*Header, error)

func (*ChainStore) GetHeaderHashByHeight

func (bd *ChainStore) GetHeaderHashByHeight(height uint32) Uint256

func (*ChainStore) GetHeaderHeight

func (bd *ChainStore) GetHeaderHeight() uint32

func (*ChainStore) GetHeight

func (bd *ChainStore) GetHeight() uint32

func (*ChainStore) GetLockedFromProgramHash

func (bd *ChainStore) GetLockedFromProgramHash(programHash Uint160, assetID Uint256) ([]*LockAsset, error)

func (*ChainStore) GetQuantityIssued

func (bd *ChainStore) GetQuantityIssued(assetId Uint256) (Fixed64, error)

func (*ChainStore) GetRecord

func (bd *ChainStore) GetRecord(filehash string) (Uint256, error)

func (*ChainStore) GetStorage

func (bd *ChainStore) GetStorage(key []byte) ([]byte, error)

func (*ChainStore) GetTransaction

func (bd *ChainStore) GetTransaction(hash Uint256) (*tx.Transaction, error)

func (*ChainStore) GetUnspent

func (bd *ChainStore) GetUnspent(txid Uint256, index uint16) (*tx.TxOutput, error)

func (*ChainStore) GetUnspentFromProgramHash

func (bd *ChainStore) GetUnspentFromProgramHash(programHash Uint160, assetid Uint256) ([]*tx.UTXOUnspent, error)

func (*ChainStore) GetUnspentsFromProgramHash

func (bd *ChainStore) GetUnspentsFromProgramHash(programHash Uint160) (map[Uint256][]*tx.UTXOUnspent, error)

func (*ChainStore) InitLedgerStore

func (bd *ChainStore) InitLedgerStore(l *Ledger) error

func (*ChainStore) InitLedgerStoreWithGenesisBlock

func (bd *ChainStore) InitLedgerStoreWithGenesisBlock(genesisBlock *Block, defaultBookKeeper []*crypto.PubKey) (uint32, error)

func (*ChainStore) IsBlockInStore

func (bd *ChainStore) IsBlockInStore(hash Uint256) bool

func (*ChainStore) IsDoubleSpend

func (bd *ChainStore) IsDoubleSpend(tx *tx.Transaction) bool

func (*ChainStore) IsTxHashDuplicate

func (bd *ChainStore) IsTxHashDuplicate(txhash Uint256) bool

func (*ChainStore) SaveAsset

func (bd *ChainStore) SaveAsset(assetId Uint256, asset *Asset) error

func (*ChainStore) SaveBlock

func (self *ChainStore) SaveBlock(b *Block, ledger *Ledger) error

func (*ChainStore) SaveLockedAsset

func (bd *ChainStore) SaveLockedAsset(programHash Uint160, assetID Uint256, lockAsset []*LockAsset) error

func (*ChainStore) SaveRecord

func (bd *ChainStore) SaveRecord(hash string, txhash Uint256) error

func (*ChainStore) SaveTransaction

func (bd *ChainStore) SaveTransaction(tx *tx.Transaction, height uint32) error

type DBCache

type DBCache struct {
	RWSet *storage.RWSet
	// contains filtered or unexported fields
}

func NewDBCache

func NewDBCache(db *ChainStore) *DBCache

func (*DBCache) AddBalance

func (cache *DBCache) AddBalance(common.Uint160, *big.Int)

func (*DBCache) Commit

func (cache *DBCache) Commit() (err error)

func (*DBCache) GetBalance

func (cache *DBCache) GetBalance(common.Uint160) *big.Int

func (*DBCache) GetCode

func (cache *DBCache) GetCode(codeHash common.Uint160) ([]byte, error)

func (*DBCache) GetCodeSize

func (cache *DBCache) GetCodeSize(common.Uint160) int

func (*DBCache) GetOrAdd

func (*DBCache) GetState

func (cache *DBCache) GetState(codeHash common.Uint160, loc common.Hash) (common.Hash, error)

func (*DBCache) GetWriteSet

func (cache *DBCache) GetWriteSet() *storage.RWSet

func (*DBCache) SetCode

func (cache *DBCache) SetCode(codeHash common.Uint160, code []byte)

func (*DBCache) SetState

func (cache *DBCache) SetState(codeHash common.Uint160, loc, value common.Hash)

func (*DBCache) Suicide

func (cache *DBCache) Suicide(codeHash common.Uint160) bool

func (*DBCache) TryGet

func (cache *DBCache) TryGet(prefix store.DataEntryPrefix, key string) (states.IStateValueInterface, error)

func (*DBCache) TryGetInternal

func (cache *DBCache) TryGetInternal(prefix store.DataEntryPrefix, key string) (states.IStateValueInterface, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL