ChainStore

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const TaskChanCap = 4

Variables

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

Functions

func NewLedgerStore

func NewLedgerStore() (ILedgerStore, error)

Types

type ChainStore

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

func (*ChainStore) BatchFinish

func (db *ChainStore) BatchFinish() error

func (*ChainStore) BatchInit

func (db *ChainStore) BatchInit() 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) GetAsset

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

func (*ChainStore) GetAssets

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

func (*ChainStore) GetBlock

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

func (*ChainStore) GetBlockHash

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

func (*ChainStore) GetCurrentBlockHash

func (bd *ChainStore) GetCurrentBlockHash() Uint256

func (*ChainStore) GetHeader

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

func (*ChainStore) GetHeight

func (bd *ChainStore) GetHeight() uint32

func (*ChainStore) GetTransaction

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

func (*ChainStore) GetUnspent

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

func (*ChainStore) GetUnspentElementFromProgramHash

func (bd *ChainStore) GetUnspentElementFromProgramHash(programHash Uint168, assetid Uint256, height uint32) ([]*tx.UTXOUnspent, error)

func (*ChainStore) GetUnspentFromProgramHash

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

func (*ChainStore) GetUnspentsFromProgramHash

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

func (*ChainStore) InitLedgerStore

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

func (*ChainStore) InitLedgerStoreWithGenesisBlock

func (bd *ChainStore) InitLedgerStoreWithGenesisBlock(genesisBlock *Block) (uint32, error)

func (*ChainStore) IsBlockInStore

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

func (*ChainStore) IsDoubleSpend

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

func (*ChainStore) IsTxHashDuplicate

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

func (*ChainStore) PersistAsset

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

func (*ChainStore) PersistBlockHash

func (db *ChainStore) PersistBlockHash(b *Block) error

key: DATA_BlockHash || height value: block hash

func (*ChainStore) PersistCurrentBlock

func (db *ChainStore) PersistCurrentBlock(b *Block) error

key: SYS_CurrentBlock value: current block hash || height

func (*ChainStore) PersistTransaction

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

func (*ChainStore) PersistTransactions

func (db *ChainStore) PersistTransactions(b *Block) error

func (*ChainStore) PersistTrimmedBlock

func (db *ChainStore) PersistTrimmedBlock(b *Block) error

key: DATA_Header || block hash value: sysfee(8bytes) || trimmed block

func (*ChainStore) PersistUnspend

func (db *ChainStore) PersistUnspend(b *Block) error

func (*ChainStore) PersistUnspendUTXOs

func (db *ChainStore) PersistUnspendUTXOs(b *Block) error

func (*ChainStore) PersistUnspentWithProgramHash

func (bd *ChainStore) PersistUnspentWithProgramHash(programHash Uint168, assetid Uint256, height uint32, unspents []*tx.UTXOUnspent) error

func (*ChainStore) RemoveHeaderListElement

func (bd *ChainStore) RemoveHeaderListElement(hash Uint256)

func (*ChainStore) RollbackAsset

func (bd *ChainStore) RollbackAsset(assetId Uint256) error

func (*ChainStore) RollbackBlock

func (db *ChainStore) RollbackBlock(blockHash Uint256) error

func (*ChainStore) RollbackBlockHash

func (db *ChainStore) RollbackBlockHash(b *Block) error

func (*ChainStore) RollbackCurrentBlock

func (db *ChainStore) RollbackCurrentBlock(b *Block) error

func (*ChainStore) RollbackTransaction

func (db *ChainStore) RollbackTransaction(txn *tx.Transaction) error

func (*ChainStore) RollbackTransactions

func (db *ChainStore) RollbackTransactions(b *Block) error

func (*ChainStore) RollbackTrimemedBlock

func (db *ChainStore) RollbackTrimemedBlock(b *Block) error

func (*ChainStore) RollbackUnspend

func (db *ChainStore) RollbackUnspend(b *Block) error

func (*ChainStore) RollbackUnspendUTXOs

func (db *ChainStore) RollbackUnspendUTXOs(b *Block) error

func (*ChainStore) SaveBlock

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

type DataEntryPrefix

type DataEntryPrefix byte

DataEntryPrefix

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

	//SYSTEM
	SYS_CurrentBlock      DataEntryPrefix = 0x40
	SYS_CurrentBookKeeper DataEntryPrefix = 0x42

	//CONFIG
	CFG_Version DataEntryPrefix = 0xf0
)

Jump to

Keyboard shortcuts

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