Documentation ¶
Index ¶
- Constants
- func BlockConsumesOutpointWithAddresses(block *dcrutil.Block, addrs map[string]TxAction, c RawTransactionGetter, ...) map[string][]*dcrutil.Tx
- func BlockReceivesToAddresses(block *dcrutil.Block, addrs map[string]TxAction, params *chaincfg.Params) map[string][]*dcrutil.Tx
- func BuildStakeTree(blocks map[int64]*dcrutil.Block, netParams *chaincfg.Params, ...) (database.DB, []int64, error)
- func FeeInfoBlock(block *dcrutil.Block, c RawTransactionGetter) *dcrjson.FeeInfoBlock
- func FeeRateInfoBlock(block *dcrutil.Block, c RawTransactionGetter) *dcrjson.FeeInfoBlock
- func GetDifficultyRatio(bits uint32, params *chaincfg.Params) float64
- func HashInSlice(h chainhash.Hash, list []chainhash.Hash) bool
- func IncludesStakeTx(txHash *chainhash.Hash, block *dcrutil.Block) (int, int8)
- func IncludesTx(txHash *chainhash.Hash, block *dcrutil.Block) (int, int8)
- func MedianAmount(s []dcrutil.Amount) dcrutil.Amount
- func MedianCoin(s []float64) float64
- func RevokedTicketsInBlock(bl *dcrutil.Block) []chainhash.Hash
- func SSTXInBlock(block *dcrutil.Block, c RawTransactionGetter) []*dcrutil.Tx
- func TicketsInBlock(bl *dcrutil.Block) []chainhash.Hash
- func TicketsSpentInBlock(bl *dcrutil.Block) []chainhash.Hash
- func TxhashInSlice(txs []*dcrutil.Tx, txHash *chainhash.Hash) *dcrutil.Tx
- func VotesInBlock(bl *dcrutil.Block) []chainhash.Hash
- type BlockWatchedTx
- type RawTransactionGetter
- type TxAction
Constants ¶
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 RawTransactionGetter, params *chaincfg.Params) map[string][]*dcrutil.Tx
BlockConsumesOutpointWithAddresses checks the specified block to see if it includes transactions that spend from outputs created using any of the addresses in addrs. The TxAction for each address is not important, but it would logically be TxMined. Both regular and stake transactions are checked. The RPC client is used to get the PreviousOutPoint for each TxIn of each transaction in the block, from which the address is obtained from the PkScript of that output. chaincfg Params is requried to decode the script.
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 FeeInfoBlock ¶ added in v0.3.2
func FeeInfoBlock(block *dcrutil.Block, c RawTransactionGetter) *dcrjson.FeeInfoBlock
FeeInfoBlock computes ticket fee statistics for the tickets included in the specified block. The RPC client is used to fetch raw transaction details need to compute the fee for each sstx.
func FeeRateInfoBlock ¶ added in v0.3.2
func FeeRateInfoBlock(block *dcrutil.Block, c RawTransactionGetter) *dcrjson.FeeInfoBlock
FeeRateInfoBlock computes ticket fee rate statistics for the tickets included in the specified block. The RPC client is used to fetch raw transaction details need to compute the fee rate for each sstx.
func GetDifficultyRatio ¶ added in v0.3.2
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 ¶
HashInSlice determines if a hash exists in a slice of hashes.
func IncludesStakeTx ¶
IncludesStakeTx checks if a block contains a stake transaction hash
func IncludesTx ¶
IncludesTx checks if a block contains a transaction hash
func MedianAmount ¶
MedianAmount gets the median Amount from a slice of Amounts
func MedianCoin ¶
MedianCoin gets the median DCR from a slice of float64s
func RevokedTicketsInBlock ¶
RevokedTicketsInBlock finds all the revoked tickets in the block.
func SSTXInBlock ¶ added in v0.3.2
func SSTXInBlock(block *dcrutil.Block, c RawTransactionGetter) []*dcrutil.Tx
SSTXInBlock gets a slice containing all of the SSTX mined in a block
func TicketsInBlock ¶
TicketsInBlock finds all the new tickets in the block.
func TicketsSpentInBlock ¶
TicketsSpentInBlock finds all the tickets spent in the block.
func TxhashInSlice ¶
TxhashInSlice searches a slice of *dcrutil.Tx for a transaction with the hash txHash. If found, it returns the corresponding *Tx, otherwise nil.
Types ¶
type BlockWatchedTx ¶
BlockWatchedTx contains, for a certain block, the transactions for certain watched addresses
type RawTransactionGetter ¶ added in v0.3.2
type RawTransactionGetter interface {
GetRawTransaction(txHash *chainhash.Hash) (*dcrutil.Tx, error)
}
RawTransactionGetter is an interface satisfied by dcrrpcclient.Client, and required by functions that would otherwise require a dcrrpcclient.Client just for GetRawTransaction.