package
1.9.6
Repository: https://github.com/decred/dcrd.git
Documentation: pkg.go.dev

# README

blockchain

Build Status ISC License Doc

Package blockchain implements Decred block handling and chain selection rules.

The Decred block handling and chain selection rules are an integral, and quite likely the most important, part of Decred. At its core, Decred is a distributed consensus of which blocks are valid and which ones will comprise the main block chain (public ledger) that ultimately determines accepted transactions, so it is extremely important that fully validating nodes agree on all rules.

At a high level, this package provides support for inserting new blocks into the block chain according to the aforementioned rules. It includes functionality such as rejecting duplicate blocks, ensuring blocks and transactions follow all rules, and best chain selection along with reorganization.

Since this package does not deal with other Decred specifics such as network communication or wallets, it provides a notification system which gives the caller a high level of flexibility in how they want to react to certain events such as newly connected main chain blocks which might result in wallet updates.

A comprehensive suite of tests is provided to ensure proper functionality.

Decred Chain Processing Overview

Before a block is allowed into the block chain, it must go through an intensive series of validation rules. The following list serves as a general outline of those rules to provide some intuition into what is going on under the hood, but is by no means exhaustive:

  • Reject duplicate blocks
  • Perform a series of sanity checks on the block and its transactions such as verifying proof of work, timestamps, number and character of transactions, transaction amounts, script complexity, and merkle root calculations
  • Compare the block against predetermined checkpoints for expected timestamps and difficulty based on elapsed time since the checkpoint
  • Perform a series of more thorough checks that depend on the block's position within the block chain such as verifying block difficulties adhere to difficulty retarget rules, timestamps are after the median of the last several blocks, all transactions are finalized, checkpoint blocks match, and block versions are in line with the previous blocks
  • Determine how the block fits into the chain and perform different actions accordingly in order to ensure any side chains which have higher difficulty than the main chain become the new main chain
  • When a block is being connected to the main chain (either through reorganization of a side chain to the main chain or just extending the main chain), perform further checks on the block's transactions such as verifying transaction duplicates, script complexity for the combination of connected scripts, coinbase maturity, double spends, and connected transaction values
  • Run the transaction scripts to verify the spender is allowed to spend the coins
  • Insert the block into the block database

Processing Order

This package supports headers-first semantics such that block data can be processed out of order so long as the associated header is already known.

The headers themselves, however, must be processed in the correct order since headers that do not properly connect are rejected. In other words, orphan headers are not allowed.

The processing code always maintains the best chain as the branch tip that has the most cumulative proof of work, so it is important to keep that in mind when considering errors returned from processing blocks.

Notably, due to the ability to process blocks out of order, and the fact blocks can only be fully validated once all of their ancestors have the block data available, it is to be expected that no error is returned immediately for blocks that are valid enough to make it to the point they require the remaining ancestor block data to be fully validated even though they might ultimately end up failing validation. Similarly, because the data for a block becoming available makes any of its direct descendants that already have their data available eligible for validation, an error being returned does not necessarily mean the block being processed is the one that failed validation.

Errors

Errors returned by this package have full support for the standard library errors.Is and errors.As methods and are either the raw errors provided by underlying calls or of type blockchain.RuleError, possibly wrapped in a blockchain.MultiError. This allows the caller to differentiate between unexpected errors, such as database errors, versus errors due to rule violations through errors.As. In addition, callers can programmatically determine the specific rule violation by making use of errors.Is with any of the wrapped error kinds.

Installation and Updating

This package is internal and therefore is neither directly installed nor needs to be manually updated.

Examples

  • ProcessBlock Example Demonstrates how to create a new chain instance and use ProcessBlock to attempt to add a block to the chain. This example intentionally attempts to insert a duplicate genesis block to illustrate how an invalid block is handled.

License

Package blockchain is licensed under the copyfree ISC License.

# Packages

Package indexers implements optional block chain indexes.
No description provided by the author

# Functions

CalcCommitmentRootV1 calculates and returns the required v1 block commitment root from the filter hash it commits to.
CheckBlockSanity performs some preliminary checks on a block to ensure it is sane before continuing with block processing.
CheckDBTooOldToUpgrade returns an ErrDBTooOldToUpgrade error if the provided database can no longer be upgraded due to being too old.
CheckProofOfStake ensures that all ticket purchases in the block pay at least the amount required by the block header stake bits which indicate the target stake difficulty (aka ticket price) as claimed.
CheckTransaction performs several validation checks on a transaction that include both preliminary sanity checks that are context free as well as those which depend on whether or not an agenda is active.
CheckTransactionInputs performs a series of checks on the inputs to a transaction to ensure they are valid.
CountP2SHSigOps returns the number of signature operations for all input transactions which are of the pay-to-script-hash type.
CountSigOps returns the number of signature operations for all transaction input and output scripts in the provided transaction.
IsExpired returns where or not the passed transaction is expired according to the given block height.
IsExpiredTx returns where or not the passed transaction is expired according to the given block height.
IsFinalizedTransaction determines whether or not a transaction is finalized.
LoadUtxoDB loads (or creates when needed) the UTXO database and returns a handle to it.
LockTimeToSequence converts the passed relative lock time to a sequence number in accordance with DCP0003.
New returns a BlockChain instance using the provided configuration details.
NewLevelDbUtxoBackend returns a new instance of a backend that uses the provided leveldb database for its underlying storage.
NewMedianTime returns a new instance of concurrency-safe implementation of the MedianTimeSource interface.
NewUtxoCache returns a UtxoCache instance using the provided configuration details.
NewUtxoViewpoint returns a new empty unspent transaction output view.
SequenceLockActive determines if all of the inputs to a given transaction have achieved a relative age that surpasses the requirements specified by their respective sequence locks as calculated by CalcSequenceLock.
UseLogger uses a specified Logger to output package logging info.
UseTreasuryLogger uses a specified Logger to output treasury logging info.
ValidateTransactionScripts validates the scripts for the passed transaction using multiple goroutines.
VerifyTSpendSignature verifies that the provided signature and public key were the ones that signed the provided message transaction.

# Constants

AFAutoRevocationsEnabled may be set to indicate that the automatic ticket revocations agenda should be considered as active when checking a transaction so that any additional checks which depend on the agenda being active are applied.
AFExplicitVerUpgrades may be set to indicate that the explicit version upgrades agenda should be considered as active when checking a transaction so that any additional checks which depend on the agenda being active are applied.
AFNone is a convenience value to specifically indicate no flags.
AFSubsidySplitEnabled may be set to indicate that the modified subsidy split agenda defined in DCP00010 should be considered as active when checking a transaction so that any additional checks which depend on the agenda being active are applied.
AFSubsidySplitR2Enabled may be set to indicate that the modified subsidy split agenda defined in DCP00012 should be considered as active when checking a transaction so that any additional checks which depend on the agenda being active are applied.
AFTreasuryEnabled may be set to indicate that the treasury agenda should be considered as active when checking a transaction so that any additional checks which depend on the agenda being active are applied.
BFFastAdd may be set to indicate that several checks can be avoided for the block since it is already known to fit into the chain due to already proving it correctly links into the chain up to an assumed valid block.
BFNone is a convenience value to specifically indicate no flags.
BFNoPoWCheck may be set to indicate the proof of work check which ensures a block hashes to a value less than the required target will not be performed.
ErrBadBlockHeight indicates that a block header's embedded block height was different from where it was actually embedded in the block chain.
ErrBadCoinbaseAmountIn indicates that the AmountIn (=subsidy) for a coinbase input was incorrect.
ErrBadCoinbaseFraudProof indicates that the fraud proof for a coinbase input was non-null.
ErrBadCoinbaseOutpoint indicates that the outpoint used by a coinbase as input was non-null.
ErrBadCoinbaseScriptLen indicates the length of the signature script for a coinbase transaction is not within the valid range.
ErrBadCoinbaseValue indicates the amount of a coinbase value does not match the expected value of the subsidy plus the sum of all fees.
ErrBadCommitmentRoot indicates the calculated commitment root does not match the expected value.
ErrBadFees indicates the total fees for a block are invalid due to exceeding the maximum possible value.
ErrBadMaxDiffCheckpoint indicates a block on the version 3 test network at the height used to activate maximum difficulty semantics does not match the expected one.
ErrBadMerkleRoot indicates the calculated merkle root does not match the expected value.
ErrBadNumPayees indicates that either a vote or revocation transaction does not make the correct number of payments per the associated ticket commitments.
ErrBadPayeeScriptType indicates that either a vote or revocation transaction output that corresponds to a ticket commitment does not pay to the same script type required by the commitment.
ErrBadPayeeScriptVersion indicates that either a vote or revocation transaction output that corresponds to a ticket commitment does not use a supported script version.
ErrBadPayeeValue indicates that either a vote or revocation transaction output that corresponds to a ticket commitment does not pay the expected amount required by the commitment.
ErrBadStakebaseAmountIn indicates that the AmountIn (=subsidy) for a stakebase input was incorrect.
ErrBadStakebaseScriptLen indicates the length of the signature script for a stakebase transaction is not within the valid range.
ErrBadStakebaseScrVal indicates the signature script for a stakebase transaction was not set to the network consensus value.
ErrBadStakebaseValue indicates that a block's stake tx tree has spent more than it is allowed.
ErrBadStakeVersion indicates the block version is too old and is no longer accepted since the majority of the network has upgraded to a newer version.
ErrBadTreasurybaseAmountIn indicates that a block contains an invalid treasury contribution.
ErrBadTreasurybaseFraudProof indicates that the fraud proof for a treasurybase input was non-null.
ErrBadTreasurybaseOutpoint indicates that the outpoint used by a treasurybase as input was non-null.
ErrBadTreasurybaseScriptLen indicates the length of the signature script for a treasurybase transaction is not within the valid range.
ErrBadTSpendFraudProof indicates that the fraud proof for a treasury spend transaction input was non-null.
ErrBadTSpendOutpoint indicates that the outpoint used by a treasury spend as input was non-null.
ErrBadTSpendScriptLen indicates the length of the signature script for a treasury spend transaction is not within the valid range.
ErrBadTxInput indicates a transaction input is invalid in some way such as referencing a previous transaction outpoint which is out of range or not referencing one at all.
ErrBadTxOutValue indicates an output value for a transaction is invalid in some way such as being out of range.
ErrBlockOneInputs indicates that block height 1 coinbase transaction input zero was incorrect in some way.
ErrBlockOneOutputs indicates that block height 1 failed to incorporate the ledger addresses correctly into the transaction's outputs.
ErrBlockOneTx indicates that block height 1 failed to correctly generate the block one initial payout transaction.
ErrBlockTooBig indicates the serialized block size exceeds the maximum allowed size.
ErrBlockVersionTooOld indicates the block version is too old and is no longer accepted since the majority of the network has upgraded to a newer version.
ErrCoinbaseHeight indicates that the encoded height in the coinbase is incorrect.
ErrDBTooOldToUpgrade indicates the database version is prior to the minimum supported version for which upgrades are supported.
ErrDeploymentBadChoiceBits indicates the choice bits that represent a deployment vote choice are invalid in some way.
ErrDeploymentBadMask indicates the mask for a deployment is invalid in some way.
ErrDeploymentChoiceAbstain indicates the forced choice id for a deployment is the unusable abstaining choice.
ErrDeploymentDuplicateChoice indicates a duplicate deployment choice id exists.
ErrDeploymentMissingAbstain indicates a deployment vote does not have a choice that is marked as abstain.
ErrDeploymentMissingChoiceID indicates a choice id is not set.
ErrDeploymentMissingNo indicates a deployment vote does not have a choice that is marked as the no choice.
ErrDeploymentNonExclusiveFlags indicates a deployment choice has an invalid flag combination.
ErrDeploymentTooManyAbstain indicates a deployment vote has more than one choice that is marked as the abstaining choice.
ErrDeploymentTooManyChoices indicates there are more choices defined for a deployment that its mask can represent.
ErrDeploymentTooManyNo indicates a deployment vote has more than one choice that is marked as the no choice.
ErrDuplicateBlock indicates a block with the same hash already exists.
ErrDuplicateDeployment indicates a duplicate deployment id exists in the network parameter deployment definitions.
ErrDuplicateTx indicates a block contains an identical transaction (or at least two transactions which hash to the same value).
ErrDuplicateTxInputs indicates a transaction references the same input more than once.
ErrExpiredTx indicates that the transaction is currently expired.
ErrExpiryTxSpentEarly indicates that an output from a transaction that included an expiry field was spent before coinbase maturity many blocks had passed in the blockchain.
ErrFirstTxNotCoinbase indicates the first transaction in a block is not a coinbase transaction.
ErrFirstTxNotTreasurybase indicates the first transaction in a block is not a treasurybase transaction.
ErrForcedMainNetChoice indicates a forced choice id is configured for a deployment on the main network.
ErrForceReorgMissingChild indicates that a reorganization was attempted to be forced, but the child node to reorganize to could not be found.
ErrForceReorgSameBlock indicates that a reorganization was attempted to be forced to the same block.
ErrForceReorgWrongChain indicates that a reorganization was attempted to be forced, but the chain indicated was not mirrored by b.bestChain.
ErrForkTooOld indicates a block is attempting to fork the block chain before the fork rejection checkpoint.
ErrFraudAmountIn indicates the witness amount given was fraudulent.
ErrFraudBlockHeight indicates the witness block height given was fraudulent.
ErrFraudBlockIndex indicates the witness block index given was fraudulent.
ErrFreshStakeMismatch indicates that a block's header contained a different number of SStx as compared to what was found in the block.
ErrHighHash indicates the block does not hash to a value which is lower than the required target difficultly.
ErrImmatureSpend indicates a transaction is attempting to spend a coinbase that has not yet reached the required maturity.
ErrImmatureTicketSpend indicates that a vote or revocation is attempting to spend a ticket submission output that has not yet reached the required maturity.
ErrIncongruentVotebit indicates that the first votebit in votebits was not the same as that determined by the majority of voters in the SSGen tx included in the block.
ErrInvalidAncestorBlock indicates that an ancestor of this block has failed validation.
ErrInvalidateGenesisBlock indicates an attempt to invalidate the genesis block which is not allowed.
ErrInvalidEarlyFinalState indicates that a block before stake validation height had a non-zero final state.
ErrInvalidEarlyStakeTx indicates that a tx type other than SStx was found in the stake tx tree before the period when stake validation begins, or before the stake tx type could possibly be included in the block.
ErrInvalidEarlyVoteBits indicates that a block before stake validation height had an unallowed vote bits value.
ErrInvalidExpenditure indicates that a treasury spend transaction expenditure is out of range.
ErrInvalidFinalState indicates that the final state of the PRNG included in the block differed from the calculated final state.
ErrInvalidPiSignature indicates that a treasury spend transaction was not properly signed.
ErrInvalidRevocationTxVersion indicates that the revocation is the wrong transaction version.
ErrInvalidRevokeInput indicates that an input to a revocation transaction is either not a stake ticket submission or is not a supported version.
ErrInvalidSSRtx indicates than an SSRtx in a block could not be found to have a valid missed sstx input as per the stake ticket database.
ErrInvalidTAddChange indicates the change output of a TAdd is zero.
ErrInvalidTemplateParent indicates that a block template builds on a block that is either not the current best chain tip or its parent.
ErrInvalidTime indicates the time in the passed block has a precision that is more than one second.
ErrInvalidTreasurybaseScript indicates that the transaction output script is invalid.
ErrInvalidTreasurybaseTxOutputs indicates that the transaction does not have the correct number of outputs.
ErrInvalidTreasurybaseVersion indicates that the transaction output has the wrong version.
ErrInvalidTSpendValueIn indicates that a treasury spend transaction ValueIn does not match the encoded copy in the first TxOut.
ErrInvalidTSpendWindow indicates that this treasury spend transaction is outside of the allowed window.
ErrInvalidTVoteWindow indicates that a treasury spend transaction appeared in a block that is prior to a valid treasury vote window.
ErrInvalidVoteInput indicates that an input to a vote transaction is either not a stake ticket submission or is not a supported version.
ErrKnownInvalidBlock indicates that this block has previously failed validation.
ErrBadPayeeScriptType indicates that either a vote or revocation transaction output that corresponds to a ticket commitment does not pay to the hash required by the commitment.
ErrMissingParent indicates that the block was an orphan.
ErrMissingTxOut indicates a transaction output referenced by an input either does not exist or has already been spent.
ErrMultipleCoinbases indicates a block contains more than one coinbase transaction.
ErrMultipleTreasurybases indicates a block contains more than one treasurybase transaction.
ErrNoBlockData indicates an attempt to perform an operation on a block that requires all data to be available does not have the data.
ErrNoExpiredTicketRevocation indicates that the block does not contain a revocation for a ticket that is becoming expired as of that block.
ErrNoFilter indicates a filter for a given block hash does not exist.
ErrNoMissedTicketRevocation indicates that the block does not contain a revocation for a ticket that is becoming missed as of that block.
ErrNonstandardStakeTx indicates that a block contained a stake tx that was not one of the allowed types of a stake transactions.
ErrNoStakeTx indicates there were no stake transactions found in a block after stake validation height.
ErrNotAnAncestor indicates an attempt to fetch a chain of filters where the start hash is not an ancestor of the end hash.
ErrNotEnoughStake indicates that there was for some SStx in a given block, the given SStx did not have enough stake to meet the network target.
ErrNotEnoughTSpendVotes indicates that a treasury spend transaction does not have enough votes to be included in block.
ErrNotEnoughVotes indicates that a block contained less than a majority of voters.
ErrNoTransactions indicates the block does not have at least one transaction.
ErrNoTreasury indicates that there was no treasury payout present in the coinbase of a block after height 1 and prior to the activation of the decentralized treasury.
ErrNoTreasuryBalance indicates the treasury balance for a given block hash does not exist.
ErrNotTVI indicates that a treasury spend transaction appeared in a block that is not at a TVI interval.
ErrNoTxInputs indicates a transaction does not have any inputs.
ErrNoTxOutputs indicates a transaction does not have any outputs.
ErrOverwriteTx indicates a block contains a transaction that has the same hash as a previous transaction which has not been fully spent.
ErrPoolSize indicates an error in the ticket pool size for this block.
ErrRegTxCreateStakeOut indicates that a regular tx attempted to create a stake tagged output.
ErrRegTxInStakeTree indicates that a regular transaction was found in the stake transaction tree.
ErrRequestTooLarge indicates an attempt to request too much data in a batched request.
ErrInvalidRevNum indicates that the number of revocations from the header was not the same as the number of SSRtx included in the block.
ErrScriptMalformed indicates a transaction script is malformed in some way.
ErrScriptValidation indicates the result of executing a transaction script failed.
ErrScriptVersionTooHigh indicates a transaction script version is higher than the maximum version allowed by the active consensus rules.
ErrSerializeHeader indicates an attempt to serialize a block header failed.
ErrSpendTooHigh indicates a transaction is attempting to spend more value than the sum of all of its inputs.
ErrSSGenSubsidy indicates that there was an error in the amount of subsidy generated in the vote.
ErrStakeBelowMinimum indicates that for some SStx in a given block, the given SStx had an amount of stake below the minimum network target.
ErrStakeFees indicates an error with the fees found in the stake transaction tree.
ErrStakeTxInRegularTree indicates a stake transaction was found in the regular transaction tree.
ErrTicketCommitment indicates that a ticket commitment contains an amount that does not coincide with the associated ticket input amount.
ErrTicketExhaustion indicates extending a given block with another one would result in an unrecoverable chain due to ticket exhaustion.
ErrTicketInputScript indicates that a ticket input is not one of the supported script forms or versions.
ErrTicketUnavailable indicates that a vote in the block spent a ticket that could not be found.
ErrTimeTooNew indicates the time is too far in the future as compared the current time.
ErrTimeTooOld indicates the time is either before the median time of the last several blocks per the chain consensus rules or prior to the time that is required by max difficulty limitations on the test network.
ErrTooManyRevocations indicates more revocations were found in a block than were allowed.
ErrTooManySigOps indicates the total number of signature operations for a transaction or block exceed the maximum allowed limits.
ErrTooManySStxs indicates that more than the allowed number of SStx was found in a block.
ErrTooManyTAdds indicates the number of treasury adds in a given block is larger than the maximum allowed.
ErrTooManyVotes indicates that a block contained more than the maximum allowable number of votes.
ErrTreasurybaseHeight indicates that the encoded height in the treasurybase is incorrect.
ErrTreasurybaseOutValue ensures that the OP_TADD value of a treasurybase is not the expected amount.
ErrTreasurybaseTxNotOpReturn indicates the second output of a treasury base transaction is not an OP_RETURN.
ErrTSpendExists indicates that a duplicate treasury spend transaction has been mined on a TVI in the current best chain.
ErrTxSStxOutSpend indicates that a non SSGen or SSRtx tx attempted to spend an OP_SSTX tagged output from an SStx.
ErrTxTooBig indicates a transaction exceeds the maximum allowed size when serialized.
ErrTxVersionTooHigh indicates a transaction version is higher than the maximum version allowed by the active consensus rules.
ErrUnexpectedDifficulty indicates specified bits do not align with the expected value either because it doesn't match the calculated value based on difficulty regarding the rules or it is out of the valid range.
ErrUnfinalizedTx indicates a transaction has not been finalized.
ErrUnknownBlock indicates a requested block does not exist.
ErrUnknownDeploymentChoice indicates a choice id for a deployment does not exist.
ErrUnknownDeploymentID indicates a deployment id does not exist.
ErrUnknownDeploymentVersion indicates a version for a given deployment id was specified that does not exist.
ErrUnknownPiKey indicates that the provided public Pi Key is not a well known key.
ErrUtxoBackend indicates that a general error was encountered when accessing the UTXO backend.
ErrUtxoBackendCorruption indicates that underlying data being accessed in the UTXO backend is corrupted.
ErrUtxoBackendNotOpen indicates that the UTXO backend was accessed before it was opened or after it was closed.
ErrUtxoBackendTxClosed indicates an attempt was made to commit or rollback a UTXO backend transaction that has already had one of those operations performed.
ErrVotesMismatch indicates that the number of SSGen in the block was not equivalent to the number of votes provided in the block header.
ErrVotesOnWrongBlock indicates that an SSGen voted on a block that is not the block's parent, and so was ineligible for inclusion into that block.
ErrWrongBlockSize indicates that the block size in the header is not the actual serialized size of the block.
ErrZeroValueOutputSpend indicates that a transaction attempted to spend a zero value output.
HeaderCmtFilterIndex is the proof index for the filter header commitment.
MaxCoinbaseScriptLen is the maximum length a coinbase script can be.
MaxSigOpsPerBlock is the maximum number of signature operations allowed for a block.
MaxTAddsPerBlock is the maximum number of treasury add txs that are allowed per block.
MaxTimeOffsetSeconds is the maximum number of seconds a block time is allowed to be ahead of the current time.
MinCoinbaseScriptLen is the minimum length a coinbase script can be.
NTBlockAccepted indicates the associated block was accepted into the block chain.
NTBlockConnected indicates the associated block was connected to the main chain.
NTBlockDisconnected indicates the associated block was disconnected from the main chain.
NTChainReorgDone indicates that a chain reorganization has concluded.
NTChainReorgStarted indicates that a chain reorganization has commenced.
NTNewTickets indicates newly maturing tickets from a newly accepted block.
NTNewTipBlockChecked indicates the associated block intends to extend the current main chain and has passed all of the sanity and contextual checks such as having valid proof of work, valid merkle and stake roots, and only containing allowed votes and revocations.
NTReorganization indicates that a blockchain reorganization has taken place.
ThresholdActive is the state for a deployment for all blocks after a retarget period in which the deployment was in the ThresholdLockedIn state.
ThresholdDefined is the initial state for each deployment and is the state for the genesis block has by definition for all deployments.
ThresholdFailed is the state for a deployment once its expiration time has been reached and it did not reach the ThresholdLockedIn state.
ThresholdInvalid is an invalid state and exists for use as the zero value in error paths.
ThresholdLockedIn is the state for a deployment during the retarget period which is after the ThresholdStarted state period and the number of blocks that have voted for the deployment equal or exceed the required number of votes for the deployment.
ThresholdStarted is the state for a deployment once its start time has been reached.

# Structs

BestState houses information about the current best block and other info related to the state of the main chain as it exists from the point of view of the current best block.
BlockAcceptedNtfnsData is the structure for data indicating information about an accepted block.
BlockChain provides functions for working with the Decred block chain.
BlockConnectedNtfnsData is the structure for data indicating information about a connected block.
BlockDisconnectedNtfnsData is the structure for data indicating information about a disconnected block.
ChainQueryerAdapter provides an adapter from a BlockChain instance to the indexers.ChainQueryer interface.
ChainTipInfo models information about a chain tip.
Config is a descriptor which specifies the blockchain instance configuration.
ContextError wraps an error with additional context.
HeaderProof houses a merkle tree inclusion proof and associated proof index for a header commitment.
Notification defines notification that is sent to the caller via the callback function provided during the call to New and consists of a notification type as well as associated data that depends on the type as follows: - NTNewTipBlockChecked: *dcrutil.Block - NTBlockAccepted: *BlockAcceptedNtfnsData - NTBlockConnected: *BlockConnectedNtfnsData - NTBlockDisconnected: *BlockDisconnectedNtfnsData - NTChainReorgStarted: nil - NTChainReorgDone: nil - NTReorganization: *ReorganizationNtfnsData - NTNewTickets: *TicketNotificationsData.
ReorganizationNtfnsData is the structure for data indicating information about a reorganization.
RuleError identifies a rule violation.
SequenceLock represents the minimum timestamp and minimum block height after which a transaction can be included into a block while satisfying the relative lock times of all of its input sequence numbers.
StakeVersions is a condensed form of a dcrutil.Block that is used to prevent using gigabytes of memory.
ThresholdStateTuple contains the current state and the activated choice, when valid.
TicketNotificationsData is the structure for data indicating information about new tickets in a connected block.
TreasuryBalanceInfo models information about the treasury balance as of a given block.
UtxoBackendInfo is the structure that holds the versioning and date information for the UTXO backend.
UtxoCache is an unspent transaction output cache that sits on top of the utxo set backend and provides significant runtime performance benefits at the cost of some additional memory usage.
UtxoCacheConfig is a descriptor which specifies the utxo cache instance configuration.
UtxoEntry houses details about an individual transaction output in a utxo view such as whether or not it was contained in a coinbase tx, the height of the block that contains the tx, whether or not it is spent, its public key script, and how much it pays.
UtxoSetState represents the current state of the utxo set.
UtxoStats represents unspent output statistics on the current utxo set.
UtxoViewpoint represents a view into the set of unspent transaction outputs from a specific point of view in the chain.
VoteCounts is a compacted struct that is used to message vote counts.
VoteInfo represents information on agendas and their respective states for a consensus deployment.

# Interfaces

MedianTimeSource provides a mechanism to add several time samples which are used to determine a median time which is then used as an offset to the local clock.
PrevScripter defines an interface that provides access to scripts and their associated version keyed by an outpoint.
UtxoBackend represents a persistent storage layer for the UTXO set.
UtxoBackendIterator represents an iterator over the key/value pairs in a UtxoBackend in key order.
UtxoBackendTx represents a UtxoBackend transaction.
UtxoCacher represents a utxo cache that sits on top of a utxo set backend.

# Type aliases

AgendaFlags is a bitmask defining additional agendas to consider as active when checking transactions.
AssertError identifies an error that indicates an internal code consistency issue and should be treated as a critical and unrecoverable error.
BehaviorFlags is a bitmask defining tweaks to the normal behavior when performing chain processing and consensus rules checks.
BlockLocator is used to help locate a specific block.
ErrorKind identifies a kind of error.
MultiError houses several errors as a single error that provides full support for errors.Is and errors.As so the caller can easily determine if any of the errors match any specific error or error type.
NotificationCallback is used for a caller to provide a callback for notifications about various chain events.
NotificationType represents the type of a notification message.
ThresholdState define the various threshold states used when voting on consensus changes.
ViewFilteredSet represents a set of utxos to fetch from the cache/backend that are not already in a view.