Documentation ¶
Overview ¶
Package ngblocks is a store for blocks which contains txs
Index ¶
- Variables
- func GetBlockByHash(blockBucket *bbolt.Bucket, hash []byte) (*ngtypes.FullBlock, error)
- func GetBlockByHeight(blockBucket *bbolt.Bucket, height uint64) (*ngtypes.FullBlock, error)
- func GetLatestBlock(blockBucket *bbolt.Bucket) (*ngtypes.FullBlock, error)
- func GetLatestHash(blockBucket *bbolt.Bucket) ([]byte, error)
- func GetLatestHeight(blockBucket *bbolt.Bucket) (uint64, error)
- func GetOriginBlock(blockBucket *bbolt.Bucket) (*ngtypes.FullBlock, error)
- func GetOriginHash(blockBucket *bbolt.Bucket) ([]byte, error)
- func GetOriginHeight(blockBucket *bbolt.Bucket) (uint64, error)
- func GetTxByHash(txBucket *bbolt.Bucket, hash []byte) (*ngtypes.FullTx, error)
- func PutNewBlock(blockBucket *bbolt.Bucket, txBucket *bbolt.Bucket, block *ngtypes.FullBlock) error
- type BlockStore
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBlockHeightConflict = errors.New("already has a block on the same height") ErrPrevBlockNotExist = errors.New("prev block does not exist") )
View Source
var ErrDBNotInit = errors.New("DB not initialized")
View Source
var ErrMalformedGenesisBlock = errors.New("malformed genesis block")
View Source
var ErrPutEmptyBlock = errors.New("putting empty block into the db")
Functions ¶
func GetBlockByHash ¶
func GetBlockByHeight ¶
Types ¶
type BlockStore ¶
BlockStore managers a badger DB, which stores vaults and blocks and some helper tags for managing. TODO: Add DAG support to extend the capacity of store initialize with genesis blocks first, then load the origin in bootstrap process
func Init ¶
func Init(db *bbolt.DB, network ngtypes.Network) *BlockStore
Init will do all initialization for the block store.
func (*BlockStore) ForcePutNewBlock ¶
func (store *BlockStore) ForcePutNewBlock(blockBucket *bbolt.Bucket, txBucket *bbolt.Bucket, block *ngtypes.FullBlock) error
ForcePutNewBlock puts a block into db regardless of local store check should check block self before putting
func (*BlockStore) InitFromCheckpoint ¶
func (store *BlockStore) InitFromCheckpoint(block *ngtypes.FullBlock) error
Click to show internal directories.
Click to hide internal directories.