txdb

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2018 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeMainchain added in v0.1.4

func DecodeMainchain(data []byte) (map[uint64]*bc.Hash, error)

DecodeMainchain decodes a Mainchain from bytes

func GetBlock added in v0.1.4

func GetBlock(db dbm.DB, hash *bc.Hash) *legacy.Block

GetBlock return the block by given hash

Types

type BlockStoreStateJSON

type BlockStoreStateJSON struct {
	Height uint64
	Hash   *bc.Hash
}

BlockStoreStateJSON represents the core's db status

type Store

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

A Store encapsulates storage for blockchain validation. It satisfies the interface protocol.Store, and provides additional methods for querying current data.

func NewStore

func NewStore(db dbm.DB) *Store

NewStore creates and returns a new Store object.

func (*Store) BlockExist added in v0.1.4

func (s *Store) BlockExist(hash *bc.Hash) bool

BlockExist check if the block is stored in disk

func (*Store) GetBlock

func (s *Store) GetBlock(hash *bc.Hash) (*legacy.Block, error)

GetBlock return the block by given hash

func (*Store) GetMainchain added in v0.1.4

func (s *Store) GetMainchain(hash *bc.Hash) (map[uint64]*bc.Hash, error)

GetMainchain read the mainchain map from db

func (*Store) GetStoreStatus added in v0.1.4

func (s *Store) GetStoreStatus() BlockStoreStateJSON

GetStoreStatus return the BlockStoreStateJSON

func (*Store) GetTransactionsUtxo added in v0.3.0

func (s *Store) GetTransactionsUtxo(view *state.UtxoViewpoint, txs []*bc.Tx) error

GetTransactionsUtxo will return all the utxo that related to the input txs

func (*Store) GetUtxo added in v0.3.0

func (s *Store) GetUtxo(hash *bc.Hash) (*storage.UtxoEntry, error)

GetUtxo will search the utxo in db

func (*Store) SaveBlock

func (s *Store) SaveBlock(block *legacy.Block) error

SaveBlock persists a new block in the database.

func (*Store) SaveChainStatus added in v0.3.0

func (s *Store) SaveChainStatus(block *legacy.Block, view *state.UtxoViewpoint, m map[uint64]*bc.Hash) error

SaveChainStatus save the core's newest status && delete old status

Directories

Path Synopsis
Package storage is a generated protocol buffer package.
Package storage is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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