txhelpers

package
v0.3.0-rc Latest Latest
Warning

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

Go to latest
Published: May 23, 2017 License: ISC Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultStakeDbName is the default database name
	DefaultStakeDbName = "ffldb_stake"
)

Variables

This section is empty.

Functions

func BlockConsumesOutpointWithAddresses

func BlockConsumesOutpointWithAddresses(block *dcrutil.Block, addrs map[string]TxAction,
	c *dcrrpcclient.Client, params *chaincfg.Params) map[string][]*dcrutil.Tx

func BlockReceivesToAddresses

func BlockReceivesToAddresses(block *dcrutil.Block, addrs map[string]TxAction,
	params *chaincfg.Params) map[string][]*dcrutil.Tx

BlockReceivesToAddresses checks a block for transactions paying to the specified addresses, and creates a map of addresses to a slice of dcrutil.Tx involving the address.

func BuildStakeTree

func BuildStakeTree(blocks map[int64]*dcrutil.Block, netParams *chaincfg.Params,
	nodeClient *dcrrpcclient.Client, poolRequiredHeight int64, DBName ...string) (database.DB, []int64, error)

func FeeInfoBlock added in v0.3.2

func FeeInfoBlock(block *dcrutil.Block, c *dcrrpcclient.Client) *dcrjson.FeeInfoBlock

func GetDifficultyRatio added in v0.3.2

func GetDifficultyRatio(bits uint32, params *chaincfg.Params) float64

GetDifficultyRatio returns the proof-of-work difficulty as a multiple of the minimum difficulty using the passed bits field from the header of a block.

func HashInSlice

func HashInSlice(h chainhash.Hash, list []chainhash.Hash) bool

HashInSlice determines if a hash exists in a slice of hashes.

func IncludesStakeTx

func IncludesStakeTx(txHash *chainhash.Hash, block *dcrutil.Block) (int, int8)

IncludesStakeTx checks if a block contains a stake transaction hash

func IncludesTx

func IncludesTx(txHash *chainhash.Hash, block *dcrutil.Block) (int, int8)

IncludesTx checks if a block contains a transaction hash

func MedianAmount

func MedianAmount(s []dcrutil.Amount) dcrutil.Amount

MedianAmount gets the median Amount from a slice of Amounts

func MedianCoin

func MedianCoin(s []float64) float64

MedianCoin gets the median DCR from a slice of float64s

func RevokedTicketsInBlock

func RevokedTicketsInBlock(bl *dcrutil.Block) []chainhash.Hash

RevokedTicketsInBlock finds all the revoked tickets in the block.

func TicketsInBlock

func TicketsInBlock(bl *dcrutil.Block) []chainhash.Hash

TicketsInBlock finds all the new tickets in the block.

func TicketsSpentInBlock

func TicketsSpentInBlock(bl *dcrutil.Block) []chainhash.Hash

TicketsSpentInBlock finds all the tickets spent in the block.

func TxhashInSlice

func TxhashInSlice(txs []*dcrutil.Tx, txHash *chainhash.Hash) *dcrutil.Tx

func VotesInBlock

func VotesInBlock(bl *dcrutil.Block) []chainhash.Hash

VotesInBlock finds all the votes in the block.

Types

type BlockWatchedTx

type BlockWatchedTx struct {
	BlockHeight   int64
	TxsForAddress map[string][]*dcrutil.Tx
}

BlockWatchedTx contains, for a certain block, the transactions for certain watched addresses

type TxAction

type TxAction int32

TxAction is what is happening to the transaction (mined or inserted into mempool).

const (
	TxMined TxAction = 1 << iota
	TxInserted
)

Valid values for TxAction

Jump to

Keyboard shortcuts

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