prottest

package
v0.0.0-...-8b8382b Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package prottest provides utilities for Chain Protocol testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockKeyPairs

func BlockKeyPairs(c *protocol.Chain) ([]ed25519.PublicKey, []ed25519.PrivateKey)

BlockKeyPairs returns the configured block-signing key-pairs for the provided Chain.

func Initial

func Initial(tb testing.TB, c *protocol.Chain) *legacy.Block

Initial returns the provided Chain's initial block.

func MakeBlock

func MakeBlock(tb testing.TB, c *protocol.Chain, txs []*legacy.Tx) *legacy.Block

MakeBlock makes a new block from txs, commits it, and returns it. It assumes c's consensus program requires 0 signatures. (This is true for chains returned by NewChain.) If c requires more than 0 signatures, MakeBlock will fail. MakeBlock always makes a block; if there are no transactions in txs, it makes an empty block.

func NewChain

func NewChain(tb testing.TB, opts ...Option) *protocol.Chain

NewChain makes a new Chain. By default it uses a memstore for storage and creates an initial block using a 0/0 multisig program. It commits the initial block before returning the Chain.

Its defaults may be overridden by providing Options.

Types

type Option

type Option func(testing.TB, *config)

func WithBlockSigners

func WithBlockSigners(quorum, n int) Option

func WithOutputIDs

func WithOutputIDs(outputIDs ...bc.Hash) Option

func WithStore

func WithStore(store protocol.Store) Option

Directories

Path Synopsis
MemStore is a Store implementation that keeps all blockchain state in memory.
MemStore is a Store implementation that keeps all blockchain state in memory.

Jump to

Keyboard shortcuts

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