testutil

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MineBlocks added in v0.2.2

func MineBlocks(t *testing.T, cm *chain.Manager, addr types.Address, n int)

MineBlocks mines n blocks with the reward going to the given address.

func Network

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

Network returns a test network and genesis block.

func V2Network added in v0.2.4

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

V2Network returns a test network and genesis block with early V2 hardforks

Types

type EphemeralWalletStore

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

An EphemeralWalletStore is a Store that does not persist its state to disk. It is primarily useful for testing or as a reference implementation.

func NewEphemeralWalletStore

func NewEphemeralWalletStore() *EphemeralWalletStore

NewEphemeralWalletStore returns a new EphemeralWalletStore.

func (*EphemeralWalletStore) Tip

Tip returns the last indexed tip of the wallet.

func (*EphemeralWalletStore) UnspentSiacoinElements

func (es *EphemeralWalletStore) UnspentSiacoinElements() (utxos []types.SiacoinElement, _ error)

UnspentSiacoinElements returns the wallet's unspent siacoin outputs.

func (*EphemeralWalletStore) UpdateChainState added in v0.0.4

func (es *EphemeralWalletStore) UpdateChainState(fn func(ux wallet.UpdateTx) error) error

UpdateChainState applies and reverts chain updates to the wallet.

func (*EphemeralWalletStore) WalletEventCount added in v0.0.2

func (es *EphemeralWalletStore) WalletEventCount() (uint64, error)

WalletEventCount returns the number of events relevant to the wallet.

func (*EphemeralWalletStore) WalletEvents added in v0.0.2

func (es *EphemeralWalletStore) WalletEvents(offset, limit int) ([]wallet.Event, error)

WalletEvents returns the wallet's events.

type MemPeerStore added in v0.2.2

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

A MemPeerStore is an in-memory implementation of a PeerStore.

func NewMemPeerStore added in v0.2.2

func NewMemPeerStore() *MemPeerStore

NewMemPeerStore returns a new MemPeerStore.

func (*MemPeerStore) AddPeer added in v0.2.2

func (ps *MemPeerStore) AddPeer(addr string) error

AddPeer adds a peer to the store. If the peer already exists, nil should be returned.

func (*MemPeerStore) Ban added in v0.2.2

func (ps *MemPeerStore) Ban(addr string, duration time.Duration, reason string) error

Ban temporarily bans one or more IPs. The addr should either be a single IP with port (e.g. 1.2.3.4:5678) or a CIDR subnet (e.g. 1.2.3.4/16).

func (*MemPeerStore) Banned added in v0.2.2

func (ps *MemPeerStore) Banned(addr string) (bool, error)

Banned returns false

func (*MemPeerStore) PeerInfo added in v0.2.2

func (ps *MemPeerStore) PeerInfo(addr string) (syncer.PeerInfo, error)

PeerInfo returns the metadata for the specified peer or ErrPeerNotFound if the peer wasn't found in the store.

func (*MemPeerStore) Peers added in v0.2.2

func (ps *MemPeerStore) Peers() ([]syncer.PeerInfo, error)

Peers returns the set of known peers.

func (*MemPeerStore) UpdatePeerInfo added in v0.2.2

func (ps *MemPeerStore) UpdatePeerInfo(addr string, fn func(*syncer.PeerInfo)) error

UpdatePeerInfo updates the metadata for the specified peer. If the peer is not found, the error should be ErrPeerNotFound.

Jump to

Keyboard shortcuts

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