testutil

package
v0.3.1-smfr Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package testutil contains the common test utilities.

Index

Constants

This section is empty.

Variables

View Source
var (
	BlockData     map[string]*Block
	BlockHashData map[string]string
	MempoolData   map[string]map[string]*MempoolEntry
)

Functions

func CheckEqual

func CheckEqual(a, b interface{}) error

func CheckPctDiff

func CheckPctDiff(a, b, p float64) error

checkPctDiff checks to see whether a is within p*100% of b, returning an error if not.

func LoadData

func LoadData(datadir string)

Types

type Block

type Block struct {
	Height_    int64    `json:"height"`
	Size_      int64    `json:"size"`
	Txids_     []string `json:"tx"`
	Difficulty float64  `json:"difficulty"`
}

func GetBlock

func GetBlock(height int64) (*Block, error)

func (*Block) Height

func (b *Block) Height() int64

Height returns the block height.

func (*Block) NumHashes

func (b *Block) NumHashes() float64

Calculate expected number of hashes needed to solve this block

func (*Block) Size

func (b *Block) Size() int64

Size returns the block size.

func (*Block) Txids

func (b *Block) Txids() []string

Txids returns a slice of the block txids. User is free to do whatever with it, as a copy is made each time.

type MempoolEntry

type MempoolEntry struct {
	Size            int64    `json:"size"`
	Time            int64    `json:"time"`
	Depends         []string `json:"depends"`
	Fee             float64  `json:"fee"`
	CurrentPriority float64  `json:"currentpriority"`
}

func (*MempoolEntry) FeeRate

func (m *MempoolEntry) FeeRate() int64

Returns the tx fee rate in satoshis / kB Panics if called with a zero-value receiver

func (*MempoolEntry) IsHighPriority

func (m *MempoolEntry) IsHighPriority() bool

Whether or not the tx is "high priority". We don't want to use these txs to estimate miner's min fee rate policies.

Jump to

Keyboard shortcuts

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