Documentation ¶
Index ¶
- func Chain(params *chaincfg.Params) *beaconChain
- type BlockGenerator
- func (c *BlockGenerator) AcceptBlock(wire.BlockHeader) error
- func (c *BlockGenerator) CalcBlockSubsidy(height int32, header wire.BlockHeader) int64
- func (c *BlockGenerator) NewBlockHeader(version wire.BVersion, prevHash, merkleRootHash chainhash.Hash, ...) (wire.BlockHeader, error)
- func (c *BlockGenerator) ValidateBlockHeader(_ wire.BlockHeader) error
- func (c *BlockGenerator) ValidateCoinbaseTx(block *wire.MsgBlock, height int32) error
- type StateProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlockGenerator ¶
type BlockGenerator struct {
// contains filtered or unexported fields
}
func NewChainBlockGenerator ¶
func NewChainBlockGenerator(stateInfo StateProvider) *BlockGenerator
func (*BlockGenerator) AcceptBlock ¶
func (c *BlockGenerator) AcceptBlock(wire.BlockHeader) error
func (*BlockGenerator) CalcBlockSubsidy ¶
func (c *BlockGenerator) CalcBlockSubsidy(height int32, header wire.BlockHeader) int64
CalcBlockSubsidy returns the subsidy amount a block at the provided height should have. This is mainly used for determining how much the coinbase for newly generated blocks awards as well as validating the coinbase for blocks has the expected value.
| Year | First Block | Last block | Formula based on block number | First Block reward | Last block reward | |------|-------------|------------|---------------------------------------|--------------------|-------------------| | 1 | 1 | 49152 | `340-10*([(x-1+3*2^10)/(3*2^11])` | 340 | 260 | | 2 | 49153 | 98304 | `260-5*([(x-49153+3*2^10)/(3*2^11])` | 260 | 220 | | 3 | 98305 | 147456 | `220-15*([(x-98305+3*2^10)/(3*2^11])` | 220 | 100 | | 4 | 147457 | 196608 | `100-5*([(x-147157+3*2^10)/(3*2^11])` | 100 | 60 | | 5 | 196609 | 245760 | `60-5*([(x-196609+3*2^10)/(3*2^11])` | 60 | 20 | | 6+ | 245761 | | 20 | 20 | |
func (*BlockGenerator) NewBlockHeader ¶
func (*BlockGenerator) ValidateBlockHeader ¶
func (c *BlockGenerator) ValidateBlockHeader(_ wire.BlockHeader) error
func (*BlockGenerator) ValidateCoinbaseTx ¶
func (c *BlockGenerator) ValidateCoinbaseTx(block *wire.MsgBlock, height int32) error