chain

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChainUpdateEventType = "chain.update"
)

Variables

View Source
var ErrBlockNotFound = errors.New("block not found")
View Source
var ErrIteratorChainTip = errors.New("chain iterator is at chain tip")

Functions

This section is empty.

Types

type Chain

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

func NewChain

func NewChain(
	db *database.Database,
	eventBus *event.EventBus,
) (*Chain, error)

func (*Chain) AddBlock

func (c *Chain) AddBlock(block ledger.Block, blockNonce []byte, txn *database.Txn) error

func (*Chain) FromPoint

func (c *Chain) FromPoint(point ocommon.Point, inclusive bool) (*ChainIterator, error)

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) Rollback

func (c *Chain) Rollback(point ocommon.Point) error

func (*Chain) Tip

func (c *Chain) Tip() ochainsync.Tip

type ChainBlockEvent

type ChainBlockEvent struct {
	Point ocommon.Point
	Block database.Block
}

type ChainIterator

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

func (*ChainIterator) Next

func (ci *ChainIterator) Next(blocking bool) (*ChainIteratorResult, error)

type ChainIteratorResult

type ChainIteratorResult struct {
	Point    ocommon.Point
	Block    database.Block
	Rollback bool
}

type ChainRollbackEvent

type ChainRollbackEvent struct {
	Point ocommon.Point
}

Jump to

Keyboard shortcuts

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