blockchain

package
v0.0.0-...-041d6b2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoTxForBlock = fmt.Errorf("no transactions for including into block")
)

Functions

This section is empty.

Types

type BlockChain

type BlockChain struct {
	// contains filtered or unexported fields
}

func NewBlockChain

func NewBlockChain(db database.Database, bus EventBus.Bus, miner *Miner, drand *drand2.DrandBeacon) (*BlockChain, error)

func (*BlockChain) FetchBlock

func (bc *BlockChain) FetchBlock(blockHash []byte) (*types2.Block, error)

func (*BlockChain) FetchBlockByHeight

func (bc *BlockChain) FetchBlockByHeight(height uint64) (*types2.Block, error)

func (*BlockChain) FetchBlockData

func (bc *BlockChain) FetchBlockData(blockHash []byte) ([]*types2.Transaction, error)

func (*BlockChain) FetchBlockHeader

func (bc *BlockChain) FetchBlockHeader(blockHash []byte) (*types2.BlockHeader, error)

func (*BlockChain) FetchBlockHeaderByHeight

func (bc *BlockChain) FetchBlockHeaderByHeight(height uint64) (*types2.BlockHeader, error)

func (*BlockChain) GetLatestBlockHeight

func (bc *BlockChain) GetLatestBlockHeight() (uint64, error)

func (*BlockChain) HasBlock

func (bc *BlockChain) HasBlock(blockHash []byte) (bool, error)

func (*BlockChain) StoreBlock

func (bc *BlockChain) StoreBlock(block *types2.Block) error

func (*BlockChain) ValidateBlock

func (bc *BlockChain) ValidateBlock(block *types2.Block) error

type Miner

type Miner struct {
	// contains filtered or unexported fields
}

func NewMiner

func NewMiner(
	h host.Host,
	ethClient ethclient.EthereumSideAPI,
	privateKey crypto.PrivKey,
	mempool *pool.Mempool,
	bus EventBus.Bus,
) *Miner

func (*Miner) GetStakeInfo

func (m *Miner) GetStakeInfo(miner common.Address) (*big.Int, *big.Int, error)

func (*Miner) IsMinerEligibleToProposeBlock

func (m *Miner) IsMinerEligibleToProposeBlock(ethAddress common.Address) error

func (*Miner) MineBlock

func (m *Miner) MineBlock(randomness []byte, randomnessRound uint64) (*types2.Block, error)

func (*Miner) SetBlockchainInstance

func (m *Miner) SetBlockchainInstance(b *BlockChain)

func (*Miner) UpdateCurrentStakeInfo

func (m *Miner) UpdateCurrentStakeInfo() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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