本文整理匯總了Golang中github.com/dedis/cothority/sda.TreeNodeInstance.OnDoneCallback方法的典型用法代碼示例。如果您正苦於以下問題:Golang TreeNodeInstance.OnDoneCallback方法的具體用法?Golang TreeNodeInstance.OnDoneCallback怎麽用?Golang TreeNodeInstance.OnDoneCallback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/dedis/cothority/sda.TreeNodeInstance
的用法示例。
在下文中一共展示了TreeNodeInstance.OnDoneCallback方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: NewBFTCoSiProtocol
// NewBFTCoSiProtocol returns a new bftcosi struct
func NewBFTCoSiProtocol(n *sda.TreeNodeInstance, verify VerificationFunction) (*ProtocolBFTCoSi, error) {
// initialize the bftcosi node/protocol-instance
bft := &ProtocolBFTCoSi{
TreeNodeInstance: n,
suite: n.Suite(),
prepare: cosi.NewCosi(n.Suite(), n.Private()),
commit: cosi.NewCosi(n.Suite(), n.Private()),
verifyChan: make(chan bool),
doneProcessing: make(chan bool, 2),
doneSigning: make(chan bool, 1),
verificationFun: verify,
AggregatedPublic: n.Roster().Aggregate,
threshold: int(2.0 * math.Ceil(float64(len(n.Tree().List()))/3.0)),
}
// register channels
if err := n.RegisterChannel(&bft.announceChan); err != nil {
return nil, err
}
if err := n.RegisterChannel(&bft.commitChan); err != nil {
return nil, err
}
if err := n.RegisterChannel(&bft.challengePrepareChan); err != nil {
return nil, err
}
if err := n.RegisterChannel(&bft.challengeCommitChan); err != nil {
return nil, err
}
if err := n.RegisterChannel(&bft.responseChan); err != nil {
return nil, err
}
n.OnDoneCallback(bft.nodeDone)
return bft, nil
}