beacon

package
v0.4.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2021 License: ISC Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chain

func Chain(params *chaincfg.Params) *beaconChain

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 (c *BlockGenerator) NewBlockHeader(version wire.BVersion, prevHash, merkleRootHash chainhash.Hash,
	timestamp time.Time, bits, nonce uint32, burnReward int) (wire.BlockHeader, error)

func (*BlockGenerator) ValidateBlockHeader

func (c *BlockGenerator) ValidateBlockHeader(_ wire.BlockHeader) error

func (*BlockGenerator) ValidateCoinbaseTx

func (c *BlockGenerator) ValidateCoinbaseTx(block *wire.MsgBlock, height int32) error

type StateProvider

type StateProvider struct {
	ShardCount func() (uint32, error)
	BTCGen     btcGen
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL