consensus

package
v0.0.0-...-d9e9996 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConsensusPluginName = "consensus"
	ConsensusTypeTdpos  = "tdpos"
	ConsensusTypePow    = "pow"
	ConsensusTypeSingle = "single"
)

Question: how to support unknown consensus? when does the consensus update?

Variables

This section is empty.

Functions

This section is empty.

Types

type PluggableConsensus

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

PluggableConsensus is the struct stored the pluggable consensus of a chain

func NewPluggableConsensus

func NewPluggableConsensus(xlog log.Logger, cfg *config.NodeConfig, bcname string,
	ledger *ledger.Ledger, utxoVM *utxo.UtxoVM, gCon map[string]interface{},
	cryptoType string) (*PluggableConsensus, error)

NewPluggableConsensus create the PluggableConsensus instance

func (*PluggableConsensus) CheckMinerMatch

func (pc *PluggableConsensus) CheckMinerMatch(header *pb.Header, in *pb.InternalBlock) (bool, error)

CheckMinerMatch check whether the block is valid

func (*PluggableConsensus) CompeteMaster

func (pc *PluggableConsensus) CompeteMaster(height int64) (bool, bool)

CompeteMaster confirm whether the node is a miner or not

func (*PluggableConsensus) Finalize

func (pc *PluggableConsensus) Finalize(blockid []byte) error

Finalize is the specific implementation of interface contract

func (*PluggableConsensus) GetCoreMiners

func (pc *PluggableConsensus) GetCoreMiners() []*cons_base.MinerInfo

GetCoreMiners get the information of core miners

func (*PluggableConsensus) GetStatus

func (pc *PluggableConsensus) GetStatus() *cons_base.ConsensusStatus

GetStatus get current consensus status

func (*PluggableConsensus) GetVATWhiteList

func (pc *PluggableConsensus) GetVATWhiteList() map[string]bool

GetVATWhiteList the specific implementation of interface VAT

func (*PluggableConsensus) GetVerifiableAutogenTx

func (pc *PluggableConsensus) GetVerifiableAutogenTx(blockHeight int64, maxCount int, timestamp int64) ([]*pb.Transaction, error)

GetVerifiableAutogenTx is the specific implementation of interface VAT

func (*PluggableConsensus) ProcessBeforeMiner

func (pc *PluggableConsensus) ProcessBeforeMiner(height int64, timestamp int64) (map[string]interface{}, bool)

ProcessBeforeMiner preprocessing before mining

func (*PluggableConsensus) ProcessConfirmBlock

func (pc *PluggableConsensus) ProcessConfirmBlock(in *pb.InternalBlock) error

ProcessConfirmBlock process after block has been confirmed

func (*PluggableConsensus) ReadOutput

ReadOutput is the specific implementation of interface contract

func (*PluggableConsensus) Rollback

func (pc *PluggableConsensus) Rollback(desc *contract.TxDesc) error

Rollback is the specific implementation of interface contract

func (*PluggableConsensus) Run

func (pc *PluggableConsensus) Run(desc *contract.TxDesc) error

Run is the specific implementation of interface contract

func (*PluggableConsensus) SetContext

func (pc *PluggableConsensus) SetContext(context *contract.TxContext) error

SetContext is the specific implementation of interface contract

func (*PluggableConsensus) Stop

func (pc *PluggableConsensus) Stop()

Stop is the specific implementation of interface contract

func (*PluggableConsensus) Type

func (pc *PluggableConsensus) Type(height int64) string

Type return the consensus type of a specific height

func (*PluggableConsensus) Version

func (pc *PluggableConsensus) Version(height int64) int64

Version return the consensus version of a specific height

type StepConsensus

type StepConsensus struct {
	StartHeight int64
	Txid        []byte
	Conn        cons_base.ConsensusInterface
}

StepConsensus is the struct stored the consensus instance

Directories

Path Synopsis
* * @filename pow.go * @desc pow共识, 固定难度系数 *
* * @filename pow.go * @desc pow共识, 固定难度系数 *
Package main is the plugin implementation of single consensus
Package main is the plugin implementation of single consensus
main
wrapper for consensus-tdpos plugin
wrapper for consensus-tdpos plugin

Jump to

Keyboard shortcuts

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