interfaces

package
v1.19.13 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: BSD-3-Clause Imports: 2 Imported by: 8

Documentation

Overview

Package interfaces defines core consensus interfaces

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block interface {
	// ID returns the block's unique identifier
	ID() ids.ID

	// Parent returns the parent block's ID
	Parent() ids.ID

	// Height returns the block's height
	Height() uint64

	// Bytes returns the serialized block
	Bytes() []byte

	// Accept marks the block as accepted
	Accept(context.Context) error

	// Reject marks the block as rejected
	Reject(context.Context) error
}

Block represents a consensus block

type State

type State interface {
	// GetBlock retrieves a block by its ID
	GetBlock(ctx context.Context, blockID ids.ID) (Block, error)

	// PutBlock stores a block
	PutBlock(ctx context.Context, block Block) error

	// GetLastAccepted returns the last accepted block ID
	GetLastAccepted(ctx context.Context) (ids.ID, error)

	// SetLastAccepted sets the last accepted block ID
	SetLastAccepted(ctx context.Context, blockID ids.ID) error
}

State represents the state of the consensus

Jump to

Keyboard shortcuts

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