geec

package
v0.0.0-...-e7ebba5 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2019 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoCommittee = errors.New("not a committee member")
	ErrNoLeader    = errors.New("not leader, cannot generate a block")
)

Functions

This section is empty.

Types

type API

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

func (*API) Register

func (api *API) Register(coinbase common.Address) (bool, error)

type Geec

type Geec struct {
	InitialAccounts []common.Address

	Mux      *event.TypeMux
	Coinbase common.Address

	PendingGeecTxnLock sync.Mutex
	PendingGeecTxns    []*types.Transaction

	InitChan chan interface{}

	Registered chan interface{}

	ConsensusIP   string
	ConsensusPort string

	Breakdown bool
	// contains filtered or unexported fields
}

func New

func New(coinbase common.Address, nodecfg *node.Config, config *params.GeecConfig, mux *event.TypeMux, eth geecCore.ThwMiner) *Geec

func (*Geec) APIs

func (g *Geec) APIs(chain consensus.ChainReader) []rpc.API

func (*Geec) AskForAck

func (g *Geec) AskForAck(block *types.Block, version uint64, stop <-chan struct{}) (supporters []common.Address, err error)

func (*Geec) Author

func (g *Geec) Author(header *types.Header) (common.Address, error)

put the author (the leader of the committee)

func (*Geec) Bootstrap

func (g *Geec) Bootstrap(chain consensus.ChainReader)

Bootstarp the initial state. Cannot be called in the New method because the state is not created yet.

func (*Geec) CalcConfidence

func (g *Geec) CalcConfidence(chain consensus.ChainReader, block *types.Block) uint64

A toy function to calculate the confidence of current block

func (*Geec) CalcDifficulty

func (g *Geec) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int

func (*Geec) Finalize

func (g *Geec) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction,
	uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error)

ensuring no uncles are set. No

func (*Geec) GetConsensusIPPort

func (g *Geec) GetConsensusIPPort() (string, string)

func (*Geec) GetEthBase

func (g *Geec) GetEthBase() common.Address

func (*Geec) GetMiner

func (g *Geec) GetMiner() geecCore.ThwMiner

func (*Geec) GetNodeCfg

func (g *Geec) GetNodeCfg() (cfg *node.Config)

func (*Geec) PostEvent

func (g *Geec) PostEvent(ev interface{}) error

func (*Geec) Prepare

func (g *Geec) Prepare(chain consensus.ChainReader, header *types.Header) error

func (*Geec) Seal

func (g *Geec) Seal(chain consensus.ChainReader, block *types.Block, stop <-chan struct{}) (*types.Block, error)

Major function to achieve consensus.

func (*Geec) TxnService

func (g *Geec) TxnService(port int)

func (*Geec) VerifyHeader

func (g *Geec) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error

used to verify header downloaded from other peers.

func (*Geec) VerifyHeaders

func (g *Geec) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)

VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers concurrently. The method returns a quit channel to abort the operations and a results channel to retrieve the async verifications.

XS: its an async function.

func (*Geec) VerifySeal

func (g *Geec) VerifySeal(chain consensus.ChainReader, header *types.Header) error

double check the seal of an outgoing message.

func (*Geec) VerifyUncles

func (g *Geec) VerifyUncles(chain consensus.ChainReader, block *types.Block) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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