Documentation
¶
Index ¶
- Constants
- Variables
- type BlockNotFitChainTipError
- type BlockNotMatchHeaderError
- type Chain
- func (c *Chain) AddBlock(block ledger.Block, txn *database.Txn) error
- func (c *Chain) AddBlockHeader(header ledger.BlockHeader) error
- func (c *Chain) AddBlocks(blocks []ledger.Block) error
- func (c *Chain) BlockByPoint(point ocommon.Point, txn *database.Txn) (database.Block, error)
- func (c *Chain) FromPoint(point ocommon.Point, inclusive bool) (*ChainIterator, error)
- func (c *Chain) HeaderCount() int
- func (c *Chain) HeaderRange(count int) (ocommon.Point, ocommon.Point)
- func (c *Chain) HeaderTip() ochainsync.Tip
- func (c *Chain) Rollback(point ocommon.Point) error
- func (c *Chain) Tip() ochainsync.Tip
- type ChainBlockEvent
- type ChainId
- type ChainIterator
- type ChainIteratorResult
- type ChainManager
- func (cm *ChainManager) BlockByPoint(point ocommon.Point, txn *database.Txn) (database.Block, error)
- func (cm *ChainManager) Chain(id ChainId) *Chain
- func (cm *ChainManager) NewChain(point ocommon.Point) (*Chain, error)
- func (cm *ChainManager) NewChainFromIntersect(points []ocommon.Point) (*Chain, error)
- func (cm *ChainManager) PrimaryChain() *Chain
- type ChainRollbackEvent
Constants ¶
View Source
const (
ChainUpdateEventType = "chain.update"
)
Variables ¶
View Source
var ( ErrBlockNotFound = errors.New("block not found") ErrIntersectNotFound = errors.New("chain intersect not found") ErrRollbackBeyondEphemeralChain = errors.New( "cannot rollback ephemeral chain beyond memory buffer", ) ErrIteratorChainTip = errors.New( "chain iterator is at chain tip", ) )
Functions ¶
This section is empty.
Types ¶
type BlockNotFitChainTipError ¶ added in v0.4.6
type BlockNotFitChainTipError struct {
// contains filtered or unexported fields
}
func NewBlockNotFitChainTipError ¶ added in v0.4.6
func NewBlockNotFitChainTipError( blockHash string, blockPrevHash string, tipHash string, ) BlockNotFitChainTipError
func (BlockNotFitChainTipError) Error ¶ added in v0.4.6
func (e BlockNotFitChainTipError) Error() string
type BlockNotMatchHeaderError ¶ added in v0.4.6
type BlockNotMatchHeaderError struct {
// contains filtered or unexported fields
}
func NewBlockNotMatchHeaderError ¶ added in v0.4.6
func NewBlockNotMatchHeaderError( blockHash string, headerHash string, ) BlockNotMatchHeaderError
func (BlockNotMatchHeaderError) Error ¶ added in v0.4.6
func (e BlockNotMatchHeaderError) Error() string
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
func (*Chain) AddBlockHeader ¶ added in v0.4.6
func (c *Chain) AddBlockHeader(header ledger.BlockHeader) error
func (*Chain) BlockByPoint ¶ added in v0.4.6
func (*Chain) FromPoint ¶
FromPoint returns a ChainIterator starting at the specified point. If inclusive is true, the iterator will start at the specified point. Otherwise it will start at the point following the specified point
func (*Chain) HeaderCount ¶ added in v0.4.6
func (*Chain) HeaderRange ¶ added in v0.4.6
func (*Chain) HeaderTip ¶ added in v0.4.6
func (c *Chain) HeaderTip() ochainsync.Tip
func (*Chain) Tip ¶
func (c *Chain) Tip() ochainsync.Tip
type ChainIterator ¶
type ChainIterator struct {
// contains filtered or unexported fields
}
func (*ChainIterator) Next ¶
func (ci *ChainIterator) Next(blocking bool) (*ChainIteratorResult, error)
type ChainIteratorResult ¶
type ChainManager ¶ added in v0.11.0
type ChainManager struct {
// contains filtered or unexported fields
}
func NewManager ¶ added in v0.11.0
func (*ChainManager) BlockByPoint ¶ added in v0.11.0
func (*ChainManager) Chain ¶ added in v0.11.0
func (cm *ChainManager) Chain(id ChainId) *Chain
func (*ChainManager) NewChain ¶ added in v0.11.0
func (cm *ChainManager) NewChain(point ocommon.Point) (*Chain, error)
NewChain creates a new Chain that forks from the primary chain at the specified point. This is useful for managing outbound ChainSync clients
func (*ChainManager) NewChainFromIntersect ¶ added in v0.11.0
func (cm *ChainManager) NewChainFromIntersect( points []ocommon.Point, ) (*Chain, error)
NewChainFromIntersect creates a new Chain that forks the primary chain at the latest common point.
func (*ChainManager) PrimaryChain ¶ added in v0.11.0
func (cm *ChainManager) PrimaryChain() *Chain
type ChainRollbackEvent ¶
Click to show internal directories.
Click to hide internal directories.