chainbase

package
v3.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2019 License: LGPL-3.0 Imports: 14 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	*block.Block
	*blockcache.WitnessList
	Irreversible bool
}

Block will describe the block of chainbase.

type ChainBase

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

ChainBase will maintain blockchain data for memory and hard disk.

func New

func New(conf *common.Config) (*ChainBase, error)

New will return a ChainBase.

func NewMock

func NewMock(bChain block.Chain, bCache blockcache.BlockCache) *ChainBase

NewMock will return the chainbase composed of blockchain and blockcache.

func (*ChainBase) Add

func (c *ChainBase) Add(blk *block.Block, replay bool, gen bool) error

Add will add a block to block cache and verify it.

func (*ChainBase) BlockCache

func (c *ChainBase) BlockCache() blockcache.BlockCache

BlockCache return the block cache.

func (*ChainBase) BlockChain

func (c *ChainBase) BlockChain() block.Chain

BlockChain return the block chain database.

func (*ChainBase) Close

func (c *ChainBase) Close()

Close will close the chainbase.

func (*ChainBase) GetBlockByHash

func (c *ChainBase) GetBlockByHash(hash []byte) (*Block, bool)

GetBlockByHash will return the block by hash. If block is not exist, it will return nil and false.

func (*ChainBase) GetBlockHashByNum

func (c *ChainBase) GetBlockHashByNum(num int64) ([]byte, bool)

GetBlockHashByNum will return the block hash by number. If block hash is not exist, it will return nil and false.

func (*ChainBase) HeadBlock

func (c *ChainBase) HeadBlock() *Block

HeadBlock will return the head block of chainbase.

func (*ChainBase) LIBlock

func (c *ChainBase) LIBlock() *Block

LIBlock will return the last irreversible block of chainbase.

func (*ChainBase) StateDB

func (c *ChainBase) StateDB() db.MVCCDB

StateDB return the state database.

func (*ChainBase) TxPool

func (c *ChainBase) TxPool() txpool.TxPool

TxPool will return the tx pool.

Jump to

Keyboard shortcuts

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