stakeversiontests

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2016 License: ISC Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptedBlock

type AcceptedBlock struct {
	Name        string
	Block       *wire.MsgBlock
	IsMainChain bool
	IsOrphan    bool
}

AcceptedBlock defines a test instance that expects a block to be accepted to the blockchain either by extending the main chain, on a side chain, or as an orphan.

func (AcceptedBlock) FullBlockTestInstance

func (b AcceptedBlock) FullBlockTestInstance()

FullBlockTestInstance only exists to allow the AcceptedBlock to be treated as a TestInstance.

This implements the TestInstance interface.

type RejectedBlock

type RejectedBlock struct {
	Name       string
	Block      *wire.MsgBlock
	RejectCode blockchain.ErrorCode
}

RejectedBlock defines a test instance that expects a block to be rejected by the blockchain consensus rules.

func (RejectedBlock) FullBlockTestInstance

func (b RejectedBlock) FullBlockTestInstance()

FullBlockTestInstance only exists to allow the RejectedBlock to be treated as a TestInstance.

This implements the TestInstance interface.

type TestInstance

type TestInstance interface {
	FullBlockTestInstance()
}

TestInstance is an interface that describes a specific test instance returned by the tests generated in this package. It should be type asserted to one of the concrete test instance types in order to test accordingly.

func Generate

func Generate() (tests []TestInstance, err error)

Generate returns a slice of tests that can be used to exercise the consensus validation rules. The tests are intended to be flexible enough to allow both unit-style tests directly against the blockchain code as well as integration-style tests over the peer-to-peer network. To achieve that goal, each test contains additional information about the expected result, however that information can be ignored when doing comparison tests between to independent versions over the peer-to-peer network.

Jump to

Keyboard shortcuts

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