testutil

package
v2.1.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MineAndSync

func MineAndSync(t testing.TB, hn *HostNode, addr types.Address, n int)

MineAndSync is a helper to mine blocks and wait for the index to catch up between each block

func MineBlocks

func MineBlocks(t testing.TB, cn *ConsensusNode, addr types.Address, n int)

MineBlocks is a helper to mine blocks and broadcast the headers

func V1Network

func V1Network() (*consensus.Network, types.Block)

V1Network is a test helper that returns a consensus.Network and genesis block suited for testing the v1 network

func V2Network

func V2Network() (*consensus.Network, types.Block)

V2Network is a test helper that returns a consensus.Network and genesis block suited for testing after the v2 hardfork

func WaitForSync

func WaitForSync(t testing.TB, cm *chain.Manager, idx *index.Manager)

WaitForSync is a helper to wait for the chain and indexer to sync

Types

type ConsensusNode

type ConsensusNode struct {
	Store  *sqlite.Store
	Chain  *chain.Manager
	Syncer *syncer.Syncer
}

A ConsensusNode is a node with the core consensus components

func NewConsensusNode

func NewConsensusNode(t testing.TB, network *consensus.Network, genesis types.Block, log *zap.Logger) *ConsensusNode

NewConsensusNode initializes all of the consensus components and returns them. The function will clean up all resources when the test is done.

type HostNode

type HostNode struct {
	ConsensusNode

	Certs     *certificates.Manager
	Settings  *settings.ConfigManager
	Wallet    *wallet.SingleAddressWallet
	Contracts *contracts.Manager
	Volumes   *storage.VolumeManager
	Indexer   *index.Manager

	Accounts *accounts.AccountManager
	Registry *registry.Manager
}

A HostNode is a node with the core wallet components and the host components

func NewHostNode

func NewHostNode(t testing.TB, pk types.PrivateKey, network *consensus.Network, genesis types.Block, log *zap.Logger) *HostNode

NewHostNode initializes all of the hostd components and returns them. The function will clean up all resources when the test is done.

Directories

Path Synopsis
rhp

Jump to

Keyboard shortcuts

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