github.com/decred/dcrd/blockchain@v1.2.1/chaingen/doc.go (about)

     1  // Copyright (c) 2017 The Decred developers
     2  // Use of this source code is governed by an ISC
     3  // license that can be found in the LICENSE file.
     4  
     5  /*
     6  Package chaingen provides facilities for generating a full chain of blocks.
     7  
     8  Overview
     9  
    10  Many consensus-related tests require a full chain of valid blocks with several
    11  pieces of contextual information such as versions and votes.  Generating such a
    12  chain is not a trivial task due to things such as the fact that tickets must be
    13  purchased (at the correct ticket price), the appropriate winning votes must be
    14  cast (which implies keeping track of all live tickets and implementing the
    15  lottery selection algorithm), and all of the state-specific header fields such
    16  as the pool size and the proof-of-work and proof-of-stake difficulties must be
    17  set properly.
    18  
    19  In order to simplify this complex process, this package provides a generator
    20  that keeps track of all of the necessary state and generates and solves blocks
    21  accordingly while allowing the caller to manipulate the blocks via munge
    22  functions.
    23  */
    24  package chaingen