mock

package
v0.0.0-...-163fc3c Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultFrozenPeriodRange = [2]uint64{}
	DefaultTxScale           = [4]byte{20, 4, 4, 2}
	Probability              = []TxType{}
	DefaultBitLength         = 24
)

Functions

func CalcBlockSubsidy

func CalcBlockSubsidy(height uint64, chainParams *config.Params, totalBinding chainutil.Amount, numRank, bitLength int) (
	miner, superNode chainutil.Amount, err error)

Types

type BindingTxOutput

type BindingTxOutput struct {
	Value int64             // transfer value
	To    chainutil.Address // transfer to which address
	Key   *btcec.PrivateKey
	PoC   chainutil.Address // poc address
}

type BlockTxStat

type BlockTxStat struct {
	// contains filtered or unexported fields
}

type Chain

type Chain struct {
	// contains filtered or unexported fields
}

func NewMockedChain

func NewMockedChain(opt *Option) (*Chain, error)

Attention: if totalHeight < ChallengeInterval(=10), block content is fixed. if totalHeight >= ChallengeInterval(=10), blocks after ChallengeInterval is configurable.

func (*Chain) Blocks

func (c *Chain) Blocks() []*wire.MsgBlock

func (*Chain) ForkStartHeight

func (c *Chain) ForkStartHeight() int64

func (*Chain) Height

func (c *Chain) Height() int64

type CoinbasePayload

type CoinbasePayload struct {
	// contains filtered or unexported fields
}

func (CoinbasePayload) Bytes

func (p CoinbasePayload) Bytes() []byte

func (CoinbasePayload) NumStakingReward

func (p CoinbasePayload) NumStakingReward() uint32

func (CoinbasePayload) SetBytes

func (p CoinbasePayload) SetBytes(data []byte) error

type ForkOptions

type ForkOptions struct {

	// Chain forks at height FP + FPOffset
	FP ForkPoint
	// contains filtered or unexported fields
}

type ForkPoint

type ForkPoint byte
const (
	FPStakingBegin ForkPoint = 1 << iota
	FPStakingEnd
	FPStakingRewardBegin
	FPBindingBegin
	FPStandardOnce
)

type MockingMode

type MockingMode int32
const (
	Auto MockingMode = iota
	AutoFork
	Other
)

type Option

type Option struct {
	// Basic config
	// Maturity uint64
	Mode    MockingMode
	ForkOpt *ForkOptions // in AutoFork mode
	// Auto mode options
	TotalHeight         int64
	TxPerBlock          int // Max Tx Count per Block (except for coinbase)
	MinNormalTxPerBlock int // Min Normal Tx Count per Bock (except for coinbase)
	// Other mode options
	TxScale           [4]byte   // Ratio of different types of txs per block (TxNormal:TxStaking:TxBinding:TxWithdrawal)
	FrozenPeriodRange [2]uint64 // Range of frozen period of staking tx, inclusive for min and exclusive for max value
	BitLength         int

	NoNormalOutputSplit bool
}

type TxInput

type TxInput struct {
	Height              uint64            // block height
	OutPoint            wire.OutPoint     // outPoint
	PrivateKey          *btcec.PrivateKey // privateKey to unlock this output
	Redeem              []byte            // redeem script
	IsStakingWithdrawal bool
	UtxoMaturity        uint64 // staking

}

type TxOutput

type TxOutput struct {
	Value int64             // transfer value
	To    chainutil.Address // transfer to which address
	Key   *btcec.PrivateKey
}

type TxType

type TxType byte
const (
	TxNormal TxType = iota
	TxStaking
	TxBinding
	Txwithdrawal
	TxNormalSpentBroUtxo
)

Jump to

Keyboard shortcuts

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