miner

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const AtxsPerBlockLimit = 100
View Source
const DefaultFee = 1
View Source
const DefaultGasLimit = 10
View Source
const IncomingTxProtocol = "TxGossip"
View Source
const MaxAtxPerBlock = 200 //todo: move to config
View Source
const MaxTransactionsPerBlock = 20 //todo: move to config

Variables

This section is empty.

Functions

This section is empty.

Types

type AtxMemPool

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

func NewAtxMemPool

func NewAtxMemPool() *AtxMemPool

func (*AtxMemPool) Get

func (mem *AtxMemPool) Get(id types.AtxId) (*types.ActivationTx, error)

func (*AtxMemPool) GetAllItems

func (mem *AtxMemPool) GetAllItems() []*types.ActivationTx

func (*AtxMemPool) Invalidate

func (mem *AtxMemPool) Invalidate(id types.AtxId)

func (*AtxMemPool) Put

func (mem *AtxMemPool) Put(atx *types.ActivationTx)

type AtxValidator

type AtxValidator interface {
	SyntacticallyValidateAtx(atx *types.ActivationTx) error
}

type BlockBuilder

type BlockBuilder struct {
	log.Log
	Signer

	AtxPool         *AtxMemPool
	TransactionPool TxPool
	// contains filtered or unexported fields
}

func NewBlockBuilder

func NewBlockBuilder(minerID types.NodeId, sgn Signer, net p2p.Service, beginRoundEvent chan types.LayerID, hdist int,
	txPool TxPool, atxPool *AtxMemPool, weakCoin WeakCoinProvider, orph meshProvider, hare HareResultProvider,
	blockOracle oracle.BlockOracle, txValidator TxValidator, atxValidator AtxValidator, syncer Syncer, atxsPerBlock int,
	projector Projector, lg log.Log) *BlockBuilder

func (*BlockBuilder) AddTransaction

func (t *BlockBuilder) AddTransaction(tx *types.Transaction) error

used from external API call?

func (*BlockBuilder) Close

func (t *BlockBuilder) Close() error

func (*BlockBuilder) Start

func (t *BlockBuilder) Start() error

func (*BlockBuilder) ValidateAndAddTxToPool

func (t *BlockBuilder) ValidateAndAddTxToPool(tx *types.Transaction) error

type HareResultProvider

type HareResultProvider interface {
	GetResult(lid types.LayerID) ([]types.BlockID, error)
}

type Projector

type Projector interface {
	GetProjection(addr types.Address) (nonce, balance uint64, err error)
}

type Signer

type Signer interface {
	Sign(m []byte) []byte
}

type Syncer

type Syncer interface {
	FetchPoetProof(poetProofRef []byte) error
	ListenToGossip() bool
	IsSynced() bool
}

type TxMempool

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

func NewTxMemPool

func NewTxMemPool() *TxMempool

func (*TxMempool) Get

func (*TxMempool) GetProjection

func (t *TxMempool) GetProjection(addr types.Address, prevNonce, prevBalance uint64) (nonce, balance uint64)

func (*TxMempool) GetTxIdsByAddress

func (t *TxMempool) GetTxIdsByAddress(addr types.Address) []types.TransactionId

func (*TxMempool) GetTxsForBlock

func (t *TxMempool) GetTxsForBlock(numOfTxs int, getState func(addr types.Address) (nonce, balance uint64, err error)) ([]types.TransactionId, error)

func (*TxMempool) Invalidate

func (t *TxMempool) Invalidate(id types.TransactionId)

func (*TxMempool) Put

func (t *TxMempool) Put(id types.TransactionId, tx *types.Transaction)

type TxPool

type TxPool interface {
	GetTxsForBlock(numOfTxs int, getState func(addr types.Address) (nonce, balance uint64, err error)) ([]types.TransactionId, error)
	Put(id types.TransactionId, item *types.Transaction)
	Invalidate(id types.TransactionId)
}

type TxValidator

type TxValidator interface {
	AddressExists(addr types.Address) bool
	ValidateNonceAndBalance(transaction *types.Transaction) error
}

type WeakCoinProvider

type WeakCoinProvider interface {
	GetResult() bool
}

Jump to

Keyboard shortcuts

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