Documentation ¶
Index ¶
- Constants
- func Error(msg string, ctx ...interface{})
- func HBFTDebugInfo(msg string)
- func Info(msg string, ctx ...interface{})
- func LogStage(info string, isDone bool)
- func LogStageReset()
- func Trace(msg string, ctx ...interface{})
- func Warn(msg string, ctx ...interface{})
- type Elephant
- type Node
- func (node *Node) AddReplyMsg(replyMsg *hbft.ReplyMsg)
- func (node *Node) BlockSealedCompleted(blockHash common.Hash) bool
- func (node *Node) GetConfirmMsg() (*hbft.ConfirmMsg, error)
- func (node *Node) GetCurrentSealer(sealers []common.Address, selfWork bool) common.Address
- func (node *Node) GetCurrentStateStage() uint
- func (node *Node) GetFakeStagesForTest(viewID uint64) []*types.HBFTStageCompleted
- func (node *Node) GetReplyMsg(msg hbft.MsgHbftConsensus) (*hbft.ReplyMsg, error)
- func (node *Node) GetRequest(sealerAddr string, block *types.Block)
- func (node *Node) GetSealedBlockStages() ([]*types.HBFTStageCompleted, bool)
- func (node *Node) HandleConfirmMsg(confirmMsg *hbft.ConfirmMsg) (*hbft.ReplyMsg, error)
- func (node *Node) HandlePreConfirmMsg(preConfirmMsg *hbft.PreConfirmMsg) (*hbft.ReplyMsg, error)
- func (node *Node) HandleReq(reqMsg *hbft.RequestMsg) (*hbft.PreConfirmMsg, error)
- func (node *Node) HbftEcRecover(data, sig []byte) (common.Address, error)
- func (node *Node) HbftProcess(msg interface{})
- func (node *Node) HbftSign(address common.Address, passwd string, data []byte) ([]byte, error)
- func (node *Node) InitNodeTable()
- func (node *Node) IsBusy() bool
- func (node *Node) SendHBFTMsg(msg interface{}, msgType hbft.TypeHBFTMsg)
- func (node *Node) SetBusy(flag bool)
- func (node *Node) SubscribeChainHeadEvent()
- func (node *Node) UpdateNodeTable(lastSealer common.Address, lastTime int64, sealers []common.Address)
- func (node *Node) ValidateNewBlocks(preConfirmMsg *hbft.PreConfirmMsg) error
Constants ¶
View Source
const ( BlockSealingBeat = time.Millisecond * 100 BlockMinPeriodHbft = time.Second * 2 BlockMaxPeriodHbft = time.Second * 6 BlockMaxStartDelayHbft = (BlockMaxPeriodHbft - BlockMinPeriodHbft) / 2 BlockAvgPeriodHbft = BlockMaxPeriodHbft + BlockMinPeriodHbft - BlockMaxStartDelayHbft - BlockMinPeriodHbft/2 NodeServerMinCountHbft = 4 )
Variables ¶
This section is empty.
Functions ¶
func HBFTDebugInfo ¶
func HBFTDebugInfo(msg string)
func LogStageReset ¶
func LogStageReset()
Types ¶
type Elephant ¶
type Elephant interface { Etherbase() (eb common.Address, err error) AccountManager() *accounts.Manager SendBFTMsg(msg interface{}, msgType uint) GetCurRealSealers() ([]common.Address, bool) GetRealSealersByNum(number uint64) ([]common.Address, bool) Get2fRealSealersCnt() int GetCurrentBlock() *types.Block AddBFTFutureBlock(b *types.Block) BFTFutureBlocks() []*types.Block BFTOldestFutureBlock() *types.Block NextIsNewSealersFirstBlock(block *types.Block) bool ValidateNewBftBlocks(blocks []*types.Block) error SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription }
type Node ¶
type Node struct { //NodeID string NodeTable map[common.Address]int64 // stores the validators and the time that the node should start to seal a new block CurrentState *hbft.State CoinBase common.Address ReceivedBlocks []*types.Block // block buffer that store the blocks we received. ReplyBuffer *[]*hbft.ReplyMsg // stores the replies of pre-confirm or confirm messages MsgMutex sync.Mutex ReplyBufMutex sync.Mutex SuccMutex sync.Mutex Sealed map[common.Hash]bool Lamp *eth.Ethereum EleBackend Elephant AccMan *accounts.Manager // contains filtered or unexported fields }
func (*Node) AddReplyMsg ¶
func (*Node) BlockSealedCompleted ¶
func (*Node) GetConfirmMsg ¶
func (node *Node) GetConfirmMsg() (*hbft.ConfirmMsg, error)
func (*Node) GetCurrentSealer ¶
func (*Node) GetCurrentStateStage ¶
func (*Node) GetFakeStagesForTest ¶
func (node *Node) GetFakeStagesForTest(viewID uint64) []*types.HBFTStageCompleted
func (*Node) GetReplyMsg ¶
func (*Node) GetSealedBlockStages ¶
func (node *Node) GetSealedBlockStages() ([]*types.HBFTStageCompleted, bool)
func (*Node) HandleConfirmMsg ¶
HandleConfirmMsg can be called when the node receives a confirm message.
func (*Node) HandlePreConfirmMsg ¶
HandlePreConfirmMsg can be called when the node receives a pre-confirm message.
func (*Node) HandleReq ¶
func (node *Node) HandleReq(reqMsg *hbft.RequestMsg) (*hbft.PreConfirmMsg, error)
HandleReq can be called when our node starting mining a block. Consensus start procedure for the Primary.
func (*Node) HbftEcRecover ¶
func (*Node) HbftProcess ¶
func (node *Node) HbftProcess(msg interface{})
func (*Node) InitNodeTable ¶
func (node *Node) InitNodeTable()
func (*Node) SendHBFTMsg ¶
func (node *Node) SendHBFTMsg(msg interface{}, msgType hbft.TypeHBFTMsg)
func (*Node) SubscribeChainHeadEvent ¶
func (node *Node) SubscribeChainHeadEvent()
SubscribeChainHeadEvent Subscribes events from blockchain and start the loop
func (*Node) UpdateNodeTable ¶
func (*Node) ValidateNewBlocks ¶
func (node *Node) ValidateNewBlocks(preConfirmMsg *hbft.PreConfirmMsg) error
Click to show internal directories.
Click to hide internal directories.