Documentation ¶
Index ¶
- type Block
- type BlockReader
- type Chain
- func (c *Chain) AddBlock(newBlock *block.Block, receipts tx.Receipts) (*Fork, error)
- func (c *Chain) BestBlock() *block.Block
- func (c *Chain) GenesisBlock() *block.Block
- func (c *Chain) GetAncestorBlockID(descendantID thor.Bytes32, ancestorNum uint32) (thor.Bytes32, error)
- func (c *Chain) GetBlock(id thor.Bytes32) (*block.Block, error)
- func (c *Chain) GetBlockBody(id thor.Bytes32) (*block.Body, error)
- func (c *Chain) GetBlockHeader(id thor.Bytes32) (*block.Header, error)
- func (c *Chain) GetBlockRaw(id thor.Bytes32) (block.Raw, error)
- func (c *Chain) GetBlockReceipts(id thor.Bytes32) (tx.Receipts, error)
- func (c *Chain) GetTransaction(blockID thor.Bytes32, index uint64) (*tx.Transaction, error)
- func (c *Chain) GetTransactionMeta(txID thor.Bytes32, headBlockID thor.Bytes32) (*TxMeta, error)
- func (c *Chain) GetTransactionReceipt(blockID thor.Bytes32, index uint64) (*tx.Receipt, error)
- func (c *Chain) GetTrunkBlock(num uint32) (*block.Block, error)
- func (c *Chain) GetTrunkBlockHeader(num uint32) (*block.Header, error)
- func (c *Chain) GetTrunkBlockID(num uint32) (thor.Bytes32, error)
- func (c *Chain) GetTrunkBlockRaw(num uint32) (block.Raw, error)
- func (c *Chain) GetTrunkTransaction(txID thor.Bytes32) (*tx.Transaction, *TxMeta, error)
- func (c *Chain) GetTrunkTransactionMeta(txID thor.Bytes32) (*TxMeta, error)
- func (c *Chain) IsBlockExist(err error) bool
- func (c *Chain) IsNotFound(err error) bool
- func (c *Chain) NewBlockReader(position thor.Bytes32) BlockReader
- func (c *Chain) NewSeeker(headBlockID thor.Bytes32) *Seeker
- func (c *Chain) NewTicker() co.Waiter
- func (c *Chain) Tag() byte
- type Fork
- type Seeker
- type TxMeta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockReader ¶ added in v1.0.2
BlockReader defines the interface to read Block
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain describes a persistent block chain. It's thread-safe.
func (*Chain) AddBlock ¶
AddBlock add a new block into block chain. Once reorg happened (len(Trunk) > 0 && len(Branch) >0), Fork.Branch will be the chain transitted from trunk to branch. Reorg happens when isTrunk is true.
func (*Chain) GenesisBlock ¶
GenesisBlock returns genesis block.
func (*Chain) GetAncestorBlockID ¶
func (c *Chain) GetAncestorBlockID(descendantID thor.Bytes32, ancestorNum uint32) (thor.Bytes32, error)
GetAncestorBlockID get ancestor block ID of descendant for given ancestor block.
func (*Chain) GetBlockBody ¶
GetBlockBody get block body by block id.
func (*Chain) GetBlockHeader ¶
GetBlockHeader get block header by block id.
func (*Chain) GetBlockRaw ¶
GetBlockRaw get block rlp encoded bytes for given id. Never modify the returned raw block.
func (*Chain) GetBlockReceipts ¶ added in v1.0.2
GetBlockReceipts get all tx receipts in the block for given block id.
func (*Chain) GetTransaction ¶
GetTransaction get transaction for given block and index.
func (*Chain) GetTransactionMeta ¶
GetTransactionMeta get transaction meta info, on the chain defined by head block ID.
func (*Chain) GetTransactionReceipt ¶
GetTransactionReceipt get tx receipt for given block and index.
func (*Chain) GetTrunkBlock ¶
GetTrunkBlock get block on trunk by given block number.
func (*Chain) GetTrunkBlockHeader ¶
GetTrunkBlockHeader get block header on trunk by given block number.
func (*Chain) GetTrunkBlockID ¶
GetTrunkBlockID get block id on trunk by given block number.
func (*Chain) GetTrunkBlockRaw ¶
GetTrunkBlockRaw get block raw on trunk by given block number.
func (*Chain) GetTrunkTransaction ¶
GetTrunkTransaction get transaction on trunk by given tx id.
func (*Chain) GetTrunkTransactionMeta ¶
GetTrunkTransactionMeta get transaction meta info on trunk by given tx id.
func (*Chain) IsBlockExist ¶
IsBlockExist returns if the error means block was already in the chain.
func (*Chain) IsNotFound ¶
IsNotFound returns if an error means not found.
func (*Chain) NewBlockReader ¶ added in v1.0.2
func (c *Chain) NewBlockReader(position thor.Bytes32) BlockReader
NewBlockReader generate an object that implements the BlockReader interface
type Seeker ¶
type Seeker struct {
// contains filtered or unexported fields
}
Seeker to seek block by given number on the chain defined by head block ID.