helper

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FixedStandardTx added in v0.2.0

func FixedStandardTx(t *testing.T, seed uint64) transactions.Transaction

FixedStandardTx generates an encodable standard Tx with 1 input and 1 output It guarantees that for one seed the same standard Tx (incl. TxID) is always generated.

func RandomBidTx

func RandomBidTx(t *testing.T, malformed bool) (*transactions.Bid, error)

RandomBidTx returns a random bid transaction for testing

func RandomBlock

func RandomBlock(t *testing.T, height uint64, txBatchCount uint16) *block.Block

RandomBlock returns a random block for testing. For `height` see also helper.RandomHeader For txBatchCount see also helper.RandomSliceOfTxs

func RandomCertificate

func RandomCertificate(t *testing.T) *block.Certificate

RandomCertificate returns a random block certificate for testing

func RandomCoinBaseTx

func RandomCoinBaseTx(t *testing.T, malformed bool) *transactions.Coinbase

RandomCoinBaseTx returns a random coinbase transaction for testing

func RandomHeader

func RandomHeader(t *testing.T, height uint64) *block.Header

RandomHeader returns a random header for testing. `height` randomness is up to the caller. A global atomic counter per pkg can handle it

func RandomInput

func RandomInput(t *testing.T) *transactions.Input

RandomInput returns a random input for testing

func RandomInputs

func RandomInputs(t *testing.T, size int) transactions.Inputs

RandomInputs returns a slice of inputs of size `size` for testing

func RandomOutput

func RandomOutput(t *testing.T) *transactions.Output

RandomOutput returns a random output for testing

func RandomOutputs

func RandomOutputs(t *testing.T, size int) transactions.Outputs

RandomOutputs returns a slice of random outputs for testing

func RandomSlice

func RandomSlice(t *testing.T, size uint32) []byte

RandomSlice returns a random slice of size `size`

func RandomSliceOfTxs

func RandomSliceOfTxs(t *testing.T, txsBatchCount uint16) []transactions.Transaction

RandomSliceOfTxs returns a random slice of transactions for testing Each tx batch represents all 4 non-coinbase tx types

func RandomStakeTx

func RandomStakeTx(t *testing.T, malformed bool) (*transactions.Stake, error)

RandomStakeTx returns a random stake tx for testing

func RandomStandardTx

func RandomStandardTx(t *testing.T, malformed bool) *transactions.Standard

RandomStandardTx returns a random standard tx for testing

func RandomTLockTx

func RandomTLockTx(t *testing.T, malformed bool) *transactions.Timelock

RandomTLockTx returns a random timelock transaction for testing

func StartPeerReader

func StartPeerReader(conn net.Conn, bus *eventbus.EventBus, rpcBus *rpcbus.RPCBus, counter *chainsync.Counter, responseChan chan<- *bytes.Buffer) (*peer.Reader, error)

func TwoLinkedBlocks

func TwoLinkedBlocks(t *testing.T) (*block.Block, *block.Block)

TwoLinkedBlocks returns two blocks that are linked via their headers

func TxsToBuffer added in v0.2.0

func TxsToBuffer(t *testing.T, txs []transactions.Transaction) *bytes.Buffer

TxsToBuffer converts a slice of transactions to a bytes.Buffer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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