# README
mining
Overview
This package is currently a work in progress.
License
Package mining is licensed under the copyfree ISC License.
# Packages
Package cpuminer provides facilities for solving blocks (mining) using the CPU.
# Functions
CalcPriority returns a transaction priority given a transaction and the sum of each of its input values multiplied by their age (# of confirmations).
NewBgBlkTmplGenerator initializes a background block template generator with the provided parameters.
NewBlkTmplGenerator returns a new block template generator for the given policy using transactions from the provided transaction source.
NewTxMiningView creates a new mining view instance.
SortParentsByVotes takes a list of block header hashes and sorts them by the number of votes currently available for them in the votes map of mempool.
UseLogger uses a specified Logger to output package logging info.
# Constants
ErrCalcCommitmentRoot indicates that creating the header commitments and calculating the associated commitment root for a newly created block template failed.
ErrCheckConnectBlock indicates that a newly created block template failed blockchain.CheckConnectBlock.
ErrFetchTxStore indicates a transaction store failed to fetch.
ErrFraudProofIndex indicates that there was an error finding the index for a fraud proof.
ErrGetTicketInfo indicates that ticket information could not be retreived in order to connect a transaction.
ErrGettingDifficulty indicates that there was an error getting the PoW difficulty.
ErrGetTopBlock indicates that the current top block of the blockchain could not be obtained.
ErrNotEnoughVoters indicates that there were not enough voters to build a block on top of HEAD.
ErrSerializeHeader indicates an attempt to serialize a block header failed.
ErrTicketExhaustion indicates that there will not be enough mature tickets by the end of the next ticket maturity period to progress the chain.
ErrTransactionAppend indicates there was a problem adding a msgtx to a msgblock.
TURNewParent indicates the associated template has been updated because it builds on a new block as compared to the previous template.
TURNewTxns indicates the associated template has been updated because new non-vote transactions are available and have potentially been included.
TURNewVotes indicates the associated template has been updated because a new vote for the block it builds on has been received.
UnminedHeight is the height used for the "block" height field of the contextual transaction information provided in a transaction store when it has not yet been mined into a block.
# Structs
BgBlkTmplConfig holds the configuration options related to the background block template generator.
BgBlkTmplGenerator provides facilities for asynchronously generating block templates in response to various relevant events and allowing clients to subscribe for updates when new templates are generated as well as access the most recently-generated template in a concurrency-safe manner.
BlkTmplGenerator generates block templates based on a given mining policy and a transactions source.
BlockTemplate houses a block that has yet to be solved along with additional details about the fees and the number of signature operations for each transaction in the block.
Config is a descriptor containing the mining configuration.
Error identifies a mining rule violation.
Policy houses the policy (configuration parameters) which is used to control the generation of block templates.
TemplateNtfn represents a notification of a new template along with the reason it was generated.
TemplateSubscription defines a subscription to receive block template updates from the background block template generator.
TxAncestorStats is a descriptor that stores aggregated statistics for the unconfirmed ancestors of a transaction.
TxDesc is a descriptor about a transaction in a transaction source along with additional metadata.
TxMiningView represents a snapshot of all transactions, as well as the hierarchy of transactions, that are ready to be mined.
VoteDesc is a descriptor about a vote transaction in a transaction source along with additional metadata.
# Interfaces
PriorityInputser defines an interface that provides access to information about an transaction output needed to calculate a priority based on the input age of a transaction.
TxSource represents a source of transactions to consider for inclusion in new blocks.
# Type aliases
ErrorKind identifies a kind of error.
TemplateUpdateReason represents the type of a reason why a template is being updated.
TxDescFind is used to inject a transaction repository into the mining view.