Documentation ¶
Index ¶
- Variables
- func CreateBackend(engine *Pbft, nodes []configs.PbftNode) (*core.BlockChain, *core.BlockChainCache, *core.TxPool, consensus.Agency)
- func CreateGenesis(db ethdb.Database) (core.Genesis, *types.Block)
- func CreateValidatorBackend(engine *Pbft, nodes []configs.PbftNode) (*core.BlockChain, *core.BlockChainCache, *core.TxPool, consensus.Agency)
- func GenerateKeys(num int) ([]*ecdsa.PrivateKey, []*bls.SecretKey)
- func GeneratePbftNode(num int) ([]*ecdsa.PrivateKey, []*bls.SecretKey, []configs.PbftNode)
- func NewBlock(parent common.Hash, number uint64) *types.Block
- func NewBlockWithSign(parent common.Hash, number uint64, node *TestPBFT) *types.Block
- func NewEngineManager(pbfts []*TestPBFT) ([]*network.EngineManager, []discover.NodeID)
- type API
- type Bridge
- type HandleError
- type Pbft
- func (pbft *Pbft) APIs(chain consensus.ChainReader) []rpc.API
- func (pbft *Pbft) Author(header *types.Header) (common.Address, error)
- func (pbft *Pbft) AvgLatency() time.Duration
- func (pbft *Pbft) BlockExists(blockNumber uint64, blockHash common.Hash) error
- func (pbft *Pbft) CalCurrentProposer(numValidators int) uint64
- func (pbft *Pbft) CalCurrentProposerWithBlockNumber(blockNumber uint64, numValidators int) uint64
- func (pbft *Pbft) CalcBlockDeadline(timePoint time.Time) time.Time
- func (pbft *Pbft) CalcNextBlockTime(blockTime time.Time) time.Time
- func (pbft *Pbft) Close() error
- func (pbft *Pbft) Config() *ctypes.Config
- func (pbft *Pbft) ConsensusNodes() ([]discover.NodeID, error)
- func (pbft *Pbft) CurrentBlock() *types.Block
- func (pbft *Pbft) DealBlock(block *types.Block) (b *types.Block, e error)
- func (pbft *Pbft) DecodeExtra(extra []byte) (common.Hash, uint64, error)
- func (pbft *Pbft) DefaultAvgLatency() time.Duration
- func (pbft *Pbft) Evidences() string
- func (pbft *Pbft) FastSyncCommitHead(block *types.Block) error
- func (pbft *Pbft) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (pbft *Pbft) GetBlock(hash common.Hash, number uint64) *types.Block
- func (pbft *Pbft) GetBlockByHash(hash common.Hash) *types.Block
- func (pbft *Pbft) GetBlockByHashAndNum(hash common.Hash, number uint64) *types.Block
- func (pbft *Pbft) GetBlockWithoutLock(hash common.Hash, number uint64) *types.Block
- func (pbft *Pbft) GetPrepareQC(number uint64) *ctypes.QuorumCert
- func (pbft *Pbft) GetSchnorrNIZKProve() (*bls.SchnorrProof, error)
- func (pbft *Pbft) HasBlock(hash common.Hash, number uint64) bool
- func (pbft *Pbft) HighestCommitBlockBn() (uint64, common.Hash)
- func (pbft *Pbft) HighestLockBlockBn() (uint64, common.Hash)
- func (pbft *Pbft) HighestPreCommitQCBlockBn() (uint64, common.Hash)
- func (pbft *Pbft) HighestQCBlockBn() (uint64, common.Hash)
- func (pbft *Pbft) InsertChain(block *types.Block) error
- func (pbft *Pbft) IsAddBlockTimeOver() bool
- func (pbft *Pbft) IsConsensusNode() bool
- func (pbft *Pbft) IsSignedBySelf(sealHash common.Hash, header *types.Header) bool
- func (pbft *Pbft) LatestStatus() (v *protocols.GetLatestStatus)
- func (pbft *Pbft) LoadWal() (err error)
- func (pbft *Pbft) MissingPreCommit() (v *protocols.GetPreCommit, err error)
- func (pbft *Pbft) MissingPrepareVote() (v *protocols.GetPrepareVote, err error)
- func (pbft *Pbft) MissingViewChangeNodes() (v *protocols.GetViewChange, err error)
- func (pbft *Pbft) NextBaseBlock() *types.Block
- func (pbft *Pbft) NodeID() discover.NodeID
- func (pbft *Pbft) OnBlockPreCommitQuorumCert(id string, msg *protocols.BlockPreCommitQuorumCert) error
- func (pbft *Pbft) OnBlockQuorumCert(id string, msg *protocols.BlockQuorumCert) error
- func (pbft *Pbft) OnCommitError(err error)
- func (pbft *Pbft) OnGetBlockPreCommitQuorumCert(id string, msg *protocols.GetBlockPreCommitQuorumCert) error
- func (pbft *Pbft) OnGetBlockQuorumCert(id string, msg *protocols.GetBlockQuorumCert) error
- func (pbft *Pbft) OnGetLatestStatus(id string, msg *protocols.GetLatestStatus) error
- func (pbft *Pbft) OnGetPreCommit(id string, msg *protocols.GetPreCommit) error
- func (pbft *Pbft) OnGetPrepareBlock(id string, msg *protocols.GetPrepareBlock) error
- func (pbft *Pbft) OnGetPrepareVote(id string, msg *protocols.GetPrepareVote) error
- func (pbft *Pbft) OnGetQCBlockList(id string, msg *protocols.GetQCBlockList) error
- func (pbft *Pbft) OnGetViewChange(id string, msg *protocols.GetViewChange) error
- func (pbft *Pbft) OnInsertQCBlock(blocks []*types.Block, qcs []*ctypes.QuorumCert) error
- func (pbft *Pbft) OnLatestStatus(id string, msg *protocols.LatestStatus) error
- func (pbft *Pbft) OnPong(nodeID string, netLatency int64) error
- func (pbft *Pbft) OnPreCommit(id string, msg *protocols.PreCommit) error
- func (pbft *Pbft) OnPreCommits(id string, msg *protocols.PreCommits) error
- func (pbft *Pbft) OnPrepareBlock(id string, msg *protocols.PrepareBlock) error
- func (pbft *Pbft) OnPrepareBlockHash(id string, msg *protocols.PrepareBlockHash) error
- func (pbft *Pbft) OnPrepareVote(id string, msg *protocols.PrepareVote) error
- func (pbft *Pbft) OnPrepareVotes(id string, msg *protocols.PrepareVotes) error
- func (pbft *Pbft) OnSeal(block *types.Block, results chan<- *types.Block, stop <-chan struct{}, ...)
- func (pbft *Pbft) OnShouldSeal(result chan error)
- func (pbft *Pbft) OnViewChange(id string, msg *protocols.ViewChange) error
- func (pbft *Pbft) OnViewChangeQuorumCert(id string, msg *protocols.ViewChangeQuorumCert) error
- func (pbft *Pbft) OnViewChanges(id string, msg *protocols.ViewChanges) error
- func (pbft *Pbft) OnViewTimeout()
- func (pbft *Pbft) Pause()
- func (pbft *Pbft) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (pbft *Pbft) Protocols() []p2p.Protocol
- func (pbft *Pbft) ReceiveMessage(msg *ctypes.MsgInfo) error
- func (pbft *Pbft) ReceiveSyncMsg(msg *ctypes.MsgInfo) error
- func (pbft *Pbft) Resume()
- func (pbft *Pbft) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, ...) error
- func (pbft *Pbft) SealHash(header *types.Header) common.Hash
- func (pbft *Pbft) ShouldSeal(curTime time.Time) (bool, error)
- func (pbft *Pbft) Start(chain consensus.ChainReader, blockCacheWriter consensus.BlockCacheWriter, ...) error
- func (pbft *Pbft) Status() []byte
- func (pbft *Pbft) SyncBlockPreCommitQuorumCert(id string, blockNumber uint64, blockHash common.Hash, blockIndex uint32)
- func (pbft *Pbft) SyncBlockQuorumCert(id string, blockNumber uint64, blockHash common.Hash, blockIndex uint32)
- func (pbft *Pbft) SyncPrepareBlock(id string, epoch uint64, blockNumber uint64, blockIndex uint32, ...)
- func (pbft *Pbft) Syncing() bool
- func (pbft *Pbft) TracingSwitch(flag int8)
- func (pbft *Pbft) TrySetHighestLockBlock(block *types.Block)
- func (pbft *Pbft) TrySetHighestPreCommitQCBlock(block *types.Block)
- func (pbft *Pbft) TrySetHighestQCBlock(block *types.Block)
- func (pbft *Pbft) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (pbft *Pbft) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (pbft *Pbft) VerifySeal(chain consensus.ChainReader, header *types.Header) error
- type PublicAdminConsensusAPI
- type PublicDebugConsensusAPI
- type PublicPhoenixchainConsensusAPI
- type Status
- type TestPBFT
- func Mock4NodePipe(start bool) []*TestPBFT
- func Mock4NodePipe2(start bool) ([]*TestPBFT, []configs.PbftNode)
- func MockNode(pk *ecdsa.PrivateKey, sk *bls.SecretKey, nodes []configs.PbftNode, ...) *TestPBFT
- func MockValidator(pk *ecdsa.PrivateKey, sk *bls.SecretKey, nodes []configs.PbftNode, ...) *TestPBFT
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CreateBackend ¶
func CreateBackend(engine *Pbft, nodes []configs.PbftNode) (*core.BlockChain, *core.BlockChainCache, *core.TxPool, consensus.Agency)
CreateBackend returns a new Backend for testing.
func CreateValidatorBackend ¶
func CreateValidatorBackend(engine *Pbft, nodes []configs.PbftNode) (*core.BlockChain, *core.BlockChainCache, *core.TxPool, consensus.Agency)
CreateValidatorBackend returns a new ValidatorBackend for testing.
func GenerateKeys ¶
func GenerateKeys(num int) ([]*ecdsa.PrivateKey, []*bls.SecretKey)
GenerateKeys returns the public and private key pair for testing.
func GeneratePbftNode ¶
GeneratePbftNode returns a list of PbftNode for testing.
func NewBlockWithSign ¶
NewBlock returns a new block for testing.
func NewEngineManager ¶
func NewEngineManager(pbfts []*TestPBFT) ([]*network.EngineManager, []discover.NodeID)
NewEngineManager returns a list of EngineManager and NodeID.
Types ¶
type API ¶
type API interface { Status() []byte Evidences() string GetPrepareQC(number uint64) *types.QuorumCert GetSchnorrNIZKProve() (*bls.SchnorrProof, error) }
API defines an exposed API function interface.
type Bridge ¶
type Bridge interface { UpdateChainState(qcState, lockState, commitState *protocols.State) ConfirmViewChange(epoch, viewNumber uint64, block *types.Block, qc *ctypes.QuorumCert, viewChangeQC *ctypes.ViewChangeQC, preEpoch, preViewNumber uint64) SendViewChange(view *protocols.ViewChange) SendPrepareBlock(pb *protocols.PrepareBlock) SendPrepareVote(block *types.Block, vote *protocols.PrepareVote) SendPreCommit(block *types.Block, vote *protocols.PreCommit) GetViewChangeQC(epoch uint64, blockNumber uint64, viewNumber uint64) (*ctypes.ViewChangeQC, error) Close() }
Bridge encapsulates functions required to update consensus state and consensus msg. As a bridge layer for pbft and wal.
type HandleError ¶
type Pbft ¶
type Pbft struct {
// contains filtered or unexported fields
}
Pbft is the core structure of the consensus engine and is responsible for handling consensus logic.
func CreatePBFT ¶
CreatePBFT returns a new PBFT for testing.
func New ¶
func New(sysConfig *configs.PbftConfig, optConfig *ctypes.OptionsConfig, eventMux *event.TypeMux, ctx *node.ServiceContext) *Pbft
New returns a new PBFT.
func (*Pbft) APIs ¶
func (pbft *Pbft) APIs(chain consensus.ChainReader) []rpc.API
APIs returns a list of APIs provided by the consensus engine.
func (*Pbft) AvgLatency ¶
AvgLatency returns the average delay time of the specified node.
The average is the average delay between the current node and all consensus nodes. Return value unit: milliseconds.
func (*Pbft) BlockExists ¶
BlockExists is used to query whether the specified block exists in this node.
func (*Pbft) CalCurrentProposer ¶
func (*Pbft) CalCurrentProposerWithBlockNumber ¶
func (*Pbft) CalcBlockDeadline ¶
CalcBlockDeadline return the deadline of the block.
func (*Pbft) CalcNextBlockTime ¶
CalcNextBlockTime returns the deadline of the next block.
func (*Pbft) ConsensusNodes ¶
ConsensusNodes returns to the list of consensus nodes.
func (*Pbft) CurrentBlock ¶
CurrentBlock get the current lock block.
func (*Pbft) DefaultAvgLatency ¶
DefaultAvgLatency returns the avg latency of default.
func (*Pbft) FastSyncCommitHead ¶
FastSyncCommitHead processes logic that performs fast synchronization.
func (*Pbft) Finalize ¶
func (pbft *Pbft) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, receipts []*types.Receipt) (*types.Block, error)
Finalize implements consensus.Engine, no block rewards given, and returns the final block.
func (*Pbft) GetBlockByHash ¶
GetBlockByHash get the specified block by hash.
func (*Pbft) GetBlockByHashAndNum ¶
GetBlockByHash get the specified block by hash and number.
func (*Pbft) GetBlockWithoutLock ¶
GetBlockWithoutLock returns the block corresponding to the specified number and hash.
func (*Pbft) GetPrepareQC ¶
func (pbft *Pbft) GetPrepareQC(number uint64) *ctypes.QuorumCert
GetPrepareQC returns the QC data of the specified block height.
func (*Pbft) GetSchnorrNIZKProve ¶
func (pbft *Pbft) GetSchnorrNIZKProve() (*bls.SchnorrProof, error)
func (*Pbft) HighestCommitBlockBn ¶
HighestCommitBlockBn returns the highest submitted block number of the current node.
func (*Pbft) HighestLockBlockBn ¶
HighestLockBlockBn returns the highest locked block number of the current node.
func (*Pbft) HighestPreCommitQCBlockBn ¶
HighestPreCommitQCBlockBn return the highest PreCommit QC block number of the current node.
func (*Pbft) HighestQCBlockBn ¶
HighestQCBlockBn return the highest QC block number of the current node.
func (*Pbft) InsertChain ¶
InsertChain is used to insert the block into the chain.
func (*Pbft) IsAddBlockTimeOver ¶
func (*Pbft) IsConsensusNode ¶
IsConsensusNode returns whether the current node is a consensus node.
func (*Pbft) IsSignedBySelf ¶
IsSignedBySelf returns the verification result , and the result is to determine whether the block information is the signature of the current node.
func (*Pbft) LatestStatus ¶
func (pbft *Pbft) LatestStatus() (v *protocols.GetLatestStatus)
LatestStatus returns latest status.
func (*Pbft) MissingPreCommit ¶
func (pbft *Pbft) MissingPreCommit() (v *protocols.GetPreCommit, err error)
MissingPreCommit returns missing preCommit.
func (*Pbft) MissingPrepareVote ¶
func (pbft *Pbft) MissingPrepareVote() (v *protocols.GetPrepareVote, err error)
MissingPrepareVote returns missing vote.
func (*Pbft) MissingViewChangeNodes ¶
func (pbft *Pbft) MissingViewChangeNodes() (v *protocols.GetViewChange, err error)
MissingViewChangeNodes returns the node ID of the missing vote.
Notes: Use the channel to complete serial execution to prevent concurrency.
func (*Pbft) NextBaseBlock ¶
NextBaseBlock is used to calculate the next block.
func (*Pbft) OnBlockPreCommitQuorumCert ¶
func (pbft *Pbft) OnBlockPreCommitQuorumCert(id string, msg *protocols.BlockPreCommitQuorumCert) error
OnBlockQuorumCert handles the message type of BlockQuorumCertMsg.
func (*Pbft) OnBlockQuorumCert ¶
func (pbft *Pbft) OnBlockQuorumCert(id string, msg *protocols.BlockQuorumCert) error
OnBlockQuorumCert handles the message type of BlockQuorumCertMsg.
func (*Pbft) OnCommitError ¶
Asynchronous processing of errors generated by the submission block
func (*Pbft) OnGetBlockPreCommitQuorumCert ¶
func (pbft *Pbft) OnGetBlockPreCommitQuorumCert(id string, msg *protocols.GetBlockPreCommitQuorumCert) error
OnGetBlockQuorumCert handles the message type of GetBlockQuorumCertMsg.
func (*Pbft) OnGetBlockQuorumCert ¶
func (pbft *Pbft) OnGetBlockQuorumCert(id string, msg *protocols.GetBlockQuorumCert) error
OnGetBlockQuorumCert handles the message type of GetBlockQuorumCertMsg.
func (*Pbft) OnGetLatestStatus ¶
func (pbft *Pbft) OnGetLatestStatus(id string, msg *protocols.GetLatestStatus) error
OnGetLatestStatus hands GetLatestStatus messages.
main logic: 1.Compare the blockNumber of the sending node with the local node, and if the blockNumber of local node is larger then reply LatestStatus message, the message contains the status information of the local node.
func (*Pbft) OnGetPreCommit ¶
func (pbft *Pbft) OnGetPreCommit(id string, msg *protocols.GetPreCommit) error
OnGetPreCommit is responsible for processing the business logic of the GetPrepareVote message. It will synchronously return a PrepareVotes message to the sender.
func (*Pbft) OnGetPrepareBlock ¶
func (pbft *Pbft) OnGetPrepareBlock(id string, msg *protocols.GetPrepareBlock) error
OnGetPrepareBlock handles the message type of GetPrepareBlockMsg.
func (*Pbft) OnGetPrepareVote ¶
func (pbft *Pbft) OnGetPrepareVote(id string, msg *protocols.GetPrepareVote) error
OnGetPrepareVote is responsible for processing the business logic of the GetPrepareVote message. It will synchronously return a PrepareVotes message to the sender.
func (*Pbft) OnGetQCBlockList ¶
func (pbft *Pbft) OnGetQCBlockList(id string, msg *protocols.GetQCBlockList) error
OnGetQCBlockList handles the message type of GetQCBlockListMsg.
func (*Pbft) OnGetViewChange ¶
func (pbft *Pbft) OnGetViewChange(id string, msg *protocols.GetViewChange) error
OnGetViewChange responds to nodes that require viewChange.
The Epoch and viewNumber of viewChange must be consistent with the state of the current node.
func (*Pbft) OnInsertQCBlock ¶
OnInsertQCBlock performs security rule verification, view switching.
func (*Pbft) OnLatestStatus ¶
func (pbft *Pbft) OnLatestStatus(id string, msg *protocols.LatestStatus) error
OnLatestStatus is used to process LatestStatus messages that received from peer.
func (*Pbft) OnPreCommit ¶
OnPrepareVote perform security rule verification,store in blockTree, Whether to start synchronization
func (*Pbft) OnPreCommits ¶
func (pbft *Pbft) OnPreCommits(id string, msg *protocols.PreCommits) error
OnPrepareVotes handling response from GetPrepareVote response.
func (*Pbft) OnPrepareBlock ¶
func (pbft *Pbft) OnPrepareBlock(id string, msg *protocols.PrepareBlock) error
OnPrepareBlock performs security rule verification,store in blockTree, Whether to start synchronization
func (*Pbft) OnPrepareBlockHash ¶
func (pbft *Pbft) OnPrepareBlockHash(id string, msg *protocols.PrepareBlockHash) error
OnPrepareBlockHash responsible for handling PrepareBlockHash message.
Note: After receiving the PrepareBlockHash message, it is determined whether the block information exists locally. If not, send a network request to get the block data.
func (*Pbft) OnPrepareVote ¶
func (pbft *Pbft) OnPrepareVote(id string, msg *protocols.PrepareVote) error
OnPrepareVote perform security rule verification,store in blockTree, Whether to start synchronization
func (*Pbft) OnPrepareVotes ¶
func (pbft *Pbft) OnPrepareVotes(id string, msg *protocols.PrepareVotes) error
OnPrepareVotes handling response from GetPrepareVote response.
func (*Pbft) OnSeal ¶
func (pbft *Pbft) OnSeal(block *types.Block, results chan<- *types.Block, stop <-chan struct{}, complete chan<- struct{})
OnSeal is used to process the blocks that have already been generated.
func (*Pbft) OnShouldSeal ¶
OnShouldSeal determines whether the current condition of the block is satisfied.
func (*Pbft) OnViewChange ¶
func (pbft *Pbft) OnViewChange(id string, msg *protocols.ViewChange) error
OnViewChange performs security rule verification, view switching.
func (*Pbft) OnViewChangeQuorumCert ¶
func (pbft *Pbft) OnViewChangeQuorumCert(id string, msg *protocols.ViewChangeQuorumCert) error
OnViewChangeQuorumCert handles the message type of ViewChangeQuorumCertMsg.
func (*Pbft) OnViewChanges ¶
func (pbft *Pbft) OnViewChanges(id string, msg *protocols.ViewChanges) error
OnViewChanges handles the message type of ViewChangesMsg.
func (*Pbft) OnViewTimeout ¶
func (pbft *Pbft) OnViewTimeout()
OnViewTimeout performs timeout logic for view.
func (*Pbft) Prepare ¶
Prepare implements consensus.Engine, preparing all the consensus fields of the header of running the transactions on top.
func (*Pbft) ReceiveMessage ¶
ReceiveMessage Entrance: The messages related to the consensus are entered from here. The message sent from the peer node is sent to the PBFT message queue and there is a loop that will distribute the incoming message.
func (*Pbft) ReceiveSyncMsg ¶
ReceiveSyncMsg is used to receive messages that are synchronized from other nodes.
Possible message types are:
PrepareBlockVotesMsg/GetLatestStatusMsg/LatestStatusMsg/
func (*Pbft) Seal ¶
func (pbft *Pbft) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}, complete chan<- struct{}) error
Seal is used to generate a block, and block data is passed to the execution channel.
func (*Pbft) ShouldSeal ¶
ShouldSeal check if we can seal block.
func (*Pbft) Start ¶
func (pbft *Pbft) Start(chain consensus.ChainReader, blockCacheWriter consensus.BlockCacheWriter, txPool consensus.TxPoolReset, agency consensus.Agency) error
Start starts consensus engine.
func (*Pbft) SyncBlockPreCommitQuorumCert ¶
func (*Pbft) SyncBlockQuorumCert ¶
func (*Pbft) SyncPrepareBlock ¶
func (*Pbft) TracingSwitch ¶
TracingSwitch will be abandoned in the future.
func (*Pbft) TrySetHighestLockBlock ¶
func (*Pbft) TrySetHighestPreCommitQCBlock ¶
func (*Pbft) TrySetHighestQCBlock ¶
func (*Pbft) VerifyHeader ¶
VerifyHeader verify the validity of the block header.
func (*Pbft) VerifyHeaders ¶
func (pbft *Pbft) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
VerifyHeaders is used to verify the validity of block headers in batch.
func (*Pbft) VerifySeal ¶
VerifySeal implements consensus.Engine, checking whether the signature contained in the header satisfies the consensus protocol requirements.
type PublicAdminConsensusAPI ¶
type PublicAdminConsensusAPI struct {
// contains filtered or unexported fields
}
PublicAdminConsensusAPI provides an API to access the PhoenixChain blockchain. It offers only methods that operate on public data that is freely available to anyone.
func NewPublicAdminConsensusAPI ¶
func NewPublicAdminConsensusAPI(engine API) *PublicAdminConsensusAPI
NewPublicAdminConsensusAPI creates a new PhoenixChain blockchain API.
func (*PublicAdminConsensusAPI) GetSchnorrNIZKProve ¶
func (s *PublicAdminConsensusAPI) GetSchnorrNIZKProve() string
type PublicDebugConsensusAPI ¶
type PublicDebugConsensusAPI struct {
// contains filtered or unexported fields
}
PublicDebugConsensusAPI provides an API to access the PhoenixChain blockchain. It offers only methods that operate on public data that is freely available to anyone.
func NewDebugConsensusAPI ¶
func NewDebugConsensusAPI(engine API) *PublicDebugConsensusAPI
NewDebugConsensusAPI creates a new PhoenixChain blockchain API.
func (*PublicDebugConsensusAPI) ConsensusStatus ¶
func (s *PublicDebugConsensusAPI) ConsensusStatus() *Status
ConsensusStatus returns the status data of the consensus engine.
func (*PublicDebugConsensusAPI) GetPrepareQC ¶
func (s *PublicDebugConsensusAPI) GetPrepareQC(number uint64) *types.QuorumCert
GetPrepareQC returns the QC certificate corresponding to the blockNumber.
type PublicPhoenixchainConsensusAPI ¶
type PublicPhoenixchainConsensusAPI struct {
// contains filtered or unexported fields
}
PublicPhoenixchainConsensusAPI provides an API to access the PhoenixChain blockchain. It offers only methods that operate on public data that is freely available to anyone.
func NewPublicPhoenixchainConsensusAPI ¶
func NewPublicPhoenixchainConsensusAPI(engine API) *PublicPhoenixchainConsensusAPI
NewPublicPhoenixchainConsensusAPI creates a new PhoenixChain blockchain API.
func (*PublicPhoenixchainConsensusAPI) Evidences ¶
func (s *PublicPhoenixchainConsensusAPI) Evidences() string
Evidences returns the relevant data of the verification.
type TestPBFT ¶
type TestPBFT struct {
// contains filtered or unexported fields
}
TestPBFT for testing.
func Mock4NodePipe ¶
Mock4NodePipe returns a list of TestPBFT for testing.
func Mock4NodePipe2 ¶
Mock4NodePipe returns a list of TestPBFT for testing.
func MockNode ¶
func MockNode(pk *ecdsa.PrivateKey, sk *bls.SecretKey, nodes []configs.PbftNode, period uint64, amount uint32) *TestPBFT
MockNode returns a new TestPBFT for testing.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package evidence implements recording duplicate blocks and votes for pbft consensus.
|
Package evidence implements recording duplicate blocks and votes for pbft consensus. |
Package network implements a concrete consensus engines.
|
Package network implements a concrete consensus engines. |
Package wal implements the similar write-ahead logging for pbft consensus.
|
Package wal implements the similar write-ahead logging for pbft consensus. |