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

# README

fullblocktests

Build Status ISC License Doc

Package fullblocktests provides a set of full block tests to be used for testing the consensus validation rules. The tests are intended to be flexible enough to allow both unit-style tests directly against the blockchain code as well as integration style tests over the peer-to-peer network. To achieve that goal, each test contains additional information about the expected result, however that information can be ignored when doing comparison tests between two independent versions over the peer-to-peer network.

This package has intentionally been designed so it can be used as a standalone package for any projects needing to test their implementation against a full set of blocks that exercise the consensus validation rules.

Installation and Updating

This package is part of the github.com/decred/dcrd/blockchain/v5 module. Use the standard go tooling for working with modules to incorporate it.

License

Package fullblocktests is licensed under the copyfree ISC License.

# Functions

Generate returns a slice of tests that can be used to exercise the consensus validation rules.

# Constants

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.
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.
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.
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.
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.
ErrBlockOneOutputs indicates that block height 1 failed to incorporate the ledger addresses correctly into the transaction's outputs.
ErrBlockTooBig indicates the serialized block size exceeds the maximum allowed size.
ErrCoinbaseHeight indicates that the encoded height in the coinbase is incorrect.
ErrDuplicateBlock indicates a block with the same hash already exists.
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.
ErrFirstTxNotCoinbase indicates the first transaction in a block is not a coinbase transaction.
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.
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.
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.
ErrInvalidFinalState indicates that the final state of the PRNG included in the block differed from the calculated final state.
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.
ErrInvalidTime indicates the time in the passed block has a precision that is more than one second.
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.
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.
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.
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.
ErrNoTxInputs indicates a transaction does not have any inputs.
ErrNoTxOutputs indicates a transaction does not have any outputs.
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.
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.
ErrSpendTooHigh indicates a transaction is attempting to spend more value than the sum of all of its inputs.
ErrStakeBelowMinimum indicates that for some SStx in a given block, the given SStx had an amount of stake below the minimum network target.
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.
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 most recent checkpoint.
ErrTooManySigOps indicates the total number of signature operations for a transaction or block exceed the maximum allowed limits.
ErrTooManyVotes indicates that a block contained more than the maximum allowable number of votes.
ErrTxSStxOutSpend indicates that a non SSGen or SSRtx tx attempted to spend an OP_SSTX tagged output from an SStx.
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.
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.

# Structs

AcceptedBlock defines a test instance that expects a block to be accepted to the blockchain either by extending the main chain, on a side chain, or as an orphan.
ExpectedTip defines a test instance that expects a block to be the current tip of the main chain.
OrphanOrRejectedBlock defines a test instance that expects a block to either be accepted as an orphan or rejected.
RejectedBlock defines a test instance that expects a block to be rejected by the blockchain consensus rules.
RejectedNonCanonicalBlock defines a test instance that expects a serialized block that is not canonical and therefore should be rejected.
RuleError identifies a rule violation.

# Interfaces

TestInstance is an interface that describes a specific test instance returned by the tests generated in this package.

# Type aliases

ErrorKind identifies a kind of error.