blocktest

package
v1.22.46 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package blocktest provides test utilities for blocks

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	consensustest.Decidable
	HeightV    uint64
	ParentV    ids.ID
	BytesV     []byte
	TimestampV time.Time
	StatusV    uint8
	VerifyV    error
	AcceptV    error
	RejectV    error
}

Block provides a full test implementation for blocks

func (*Block) Accept

func (b *Block) Accept(ctx context.Context) error

Accept accepts the block

func (*Block) Bytes

func (b *Block) Bytes() []byte

Bytes returns the block bytes

func (*Block) Height

func (b *Block) Height() uint64

Height returns the block height

func (*Block) Parent

func (b *Block) Parent() ids.ID

Parent returns the parent block ID

func (*Block) ParentID

func (b *Block) ParentID() ids.ID

ParentID returns the parent block ID

func (*Block) Reject

func (b *Block) Reject(ctx context.Context) error

Reject rejects the block

func (*Block) Status

func (b *Block) Status() uint8

Status returns the block status as uint8

func (*Block) Timestamp

func (b *Block) Timestamp() time.Time

Timestamp returns the block timestamp

func (*Block) Verify

func (b *Block) Verify(ctx context.Context) error

Verify verifies the block

type TestBlock

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

TestBlock provides a test implementation for blocks (deprecated, use Block)

func NewTestBlock

func NewTestBlock(id []byte, height uint64, parent []byte) *TestBlock

NewTestBlock creates a new test block

func (*TestBlock) Accept

func (t *TestBlock) Accept(ctx context.Context) error

Accept marks the block as accepted

func (*TestBlock) Bytes

func (t *TestBlock) Bytes() []byte

Bytes returns the block bytes

func (*TestBlock) Height

func (t *TestBlock) Height() uint64

Height returns the block height

func (*TestBlock) ID

func (t *TestBlock) ID() []byte

ID returns the block ID

func (*TestBlock) Parent

func (t *TestBlock) Parent() []byte

Parent returns the parent block ID

func (*TestBlock) Reject

func (t *TestBlock) Reject(ctx context.Context) error

Reject marks the block as rejected

func (*TestBlock) Timestamp

func (t *TestBlock) Timestamp() time.Time

Timestamp returns the block timestamp

Jump to

Keyboard shortcuts

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