test

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2018 License: AGPL-3.0 Imports: 30 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendBlocks added in v0.4.6

func AppendBlocks(chain *protocol.Chain, num uint64) error

AppendBlocks append empty blocks to chain, mainly used to mature the coinbase tx

func CreateCoinbaseTx added in v0.4.6

func CreateCoinbaseTx(controlProgram []byte, height, txsFee uint64) (*types.Tx, error)

CreateCoinbaseTx create coinbase tx at block height

func CreateSpendInput added in v0.4.6

func CreateSpendInput(tx *types.Tx, outputIndex uint64) (*types.SpendInput, error)

CreateSpendInput create SpendInput which spent the output from tx

func CreateTxFromTx added in v0.4.6

func CreateTxFromTx(baseTx *types.Tx, outputIndex uint64, outputAmount uint64, ctrlProgram []byte) (*types.Tx, error)

CreateTxFromTx create a tx spent the output in outputIndex at baseTx

func MockBlock

func MockBlock() *bc.Block

MockBlock mock a block

func MockChain

func MockChain(testDB dbm.DB) (*protocol.Chain, *leveldb.Store, *protocol.TxPool, error)

MockChain mock chain with genesis block

func MockSign

func MockSign(tpl *txbuilder.Template, hsm *pseudohsm.HSM, password string) (bool, error)

MockSign sign a tx

func MockTx

func MockTx(utxo *account.UTXO, testAccount *account.Account) (*txbuilder.Template, *types.TxData, error)

MockTx mock a tx

func MockTxPool

func MockTxPool() *protocol.TxPool

MockTxPool mock transaction pool

func MockUTXO

func MockUTXO(controlProg *account.CtrlProgram) *account.UTXO

MockUTXO mock a utxo

func NewBlock added in v0.4.6

func NewBlock(chain *protocol.Chain, txs []*types.Tx, controlProgram []byte) (*types.Block, error)

NewBlock create block according to the current status of chain

func ReplaceCoinbase added in v0.4.6

func ReplaceCoinbase(block *types.Block, coinbaseTx *types.Tx) (err error)

ReplaceCoinbase replace the coinbase tx of block with coinbaseTx

func SignInstructionFor added in v0.4.6

func SignInstructionFor(input *types.SpendInput, db db.DB, signer *signers.Signer) (*txbuilder.SigningInstruction, error)

SignInstructionFor read CtrlProgram from db, construct SignInstruction for SpendInput

func Solve added in v0.4.6

func Solve(seed *bc.Hash, block *types.Block)

Solve simulate solve difficulty by add result to cache

func SolveAndUpdate added in v0.4.6

func SolveAndUpdate(chain *protocol.Chain, block *types.Block) error

SolveAndUpdate solve difficulty and update chain status

Types

type TxGenerator added in v0.4.6

type TxGenerator struct {
	Builder        *txbuilder.TemplateBuilder
	AccountManager *account.Manager
	Assets         *asset.Registry
	Hsm            *pseudohsm.HSM
}

TxGenerator used to generate new tx

func NewTxGenerator added in v0.4.6

func NewTxGenerator(accountManager *account.Manager, assets *asset.Registry, hsm *pseudohsm.HSM) *TxGenerator

NewTxGenerator create a TxGenerator

func (*TxGenerator) AddIssuanceInput added in v0.4.6

func (g *TxGenerator) AddIssuanceInput(assetAlias string, amount uint64) error

AddIssuanceInput add a issue input

func (*TxGenerator) AddRetirement added in v0.4.6

func (g *TxGenerator) AddRetirement(assetAlias string, amount uint64) error

AddRetirement add a retirement output

func (*TxGenerator) AddSpendInput added in v0.4.6

func (g *TxGenerator) AddSpendInput(accountAlias, assetAlias string, amount uint64) error

AddSpendInput add a spend input

func (*TxGenerator) AddTxInput added in v0.4.6

func (g *TxGenerator) AddTxInput(txInput *types.TxInput, signInstruction *txbuilder.SigningInstruction) error

AddTxInput add a tx input and signing instruction

func (*TxGenerator) AddTxInputFromUtxo added in v0.4.6

func (g *TxGenerator) AddTxInputFromUtxo(utxo *account.UTXO, accountAlias string) error

AddTxInputFromUtxo add a tx input which spent the utxo

func (*TxGenerator) AddTxOutput added in v0.4.6

func (g *TxGenerator) AddTxOutput(accountAlias, assetAlias string, amount uint64) error

AddTxOutput add a tx output

func (*TxGenerator) Reset added in v0.4.6

func (g *TxGenerator) Reset()

Reset reset transaction builder, used to create a new tx

func (*TxGenerator) Sign added in v0.4.6

func (g *TxGenerator) Sign(passwords []string) (*types.Tx, error)

Sign used to sign tx

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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