Documentation ¶
Index ¶
- Constants
- type PluggableConsensus
- func (pc *PluggableConsensus) CheckMinerMatch(header *pb.Header, in *pb.InternalBlock) (bool, error)
- func (pc *PluggableConsensus) CompeteMaster(height int64) (bool, bool)
- func (pc *PluggableConsensus) Finalize(blockid []byte) error
- func (pc *PluggableConsensus) GetCoreMiners() []*cons_base.MinerInfo
- func (pc *PluggableConsensus) GetStatus() *cons_base.ConsensusStatus
- func (pc *PluggableConsensus) GetVATWhiteList() map[string]bool
- func (pc *PluggableConsensus) GetVerifiableAutogenTx(blockHeight int64, maxCount int, timestamp int64) ([]*pb.Transaction, error)
- func (pc *PluggableConsensus) ProcessBeforeMiner(height int64, timestamp int64) (map[string]interface{}, bool)
- func (pc *PluggableConsensus) ProcessConfirmBlock(in *pb.InternalBlock) error
- func (pc *PluggableConsensus) ReadOutput(desc *contract.TxDesc) (contract.ContractOutputInterface, error)
- func (pc *PluggableConsensus) Rollback(desc *contract.TxDesc) error
- func (pc *PluggableConsensus) Run(desc *contract.TxDesc) error
- func (pc *PluggableConsensus) SetContext(context *contract.TxContext) error
- func (pc *PluggableConsensus) Stop()
- func (pc *PluggableConsensus) Type(height int64) string
- func (pc *PluggableConsensus) Version(height int64) int64
- type StepConsensus
Constants ¶
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 ¶
func (pc *PluggableConsensus) ReadOutput(desc *contract.TxDesc) (contract.ContractOutputInterface, error)
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 |