test

package
v1.0.5-hotfix-6568627 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2018 License: AGPL-3.0 Imports: 31 Imported by: 0

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 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