github.com/annchain/OG@v0.0.9/consensus/dkg/disordered_cache.go (about)

     1  package dkg
     2  
     3  import (
     4  	dkg "github.com/annchain/kyber/v3/share/dkg/pedersen"
     5  )
     6  
     7  type Stage int
     8  
     9  const (
    10  	StageStart Stage = iota
    11  	StageDealReceived
    12  	//StageDealResponseReceived
    13  	//StageReady
    14  )
    15  
    16  // DisorderedCache collects necessary prerequisites to make message in order
    17  type DisorderedCache map[uint32]Stagable
    18  
    19  // Stagable will justify which stage it is currently on, depending on the messages it received
    20  // e.g., if the messages received are 1,2,6,7,8, then the current stage is 2
    21  type Stagable interface {
    22  	GetCurrentStage() Stage
    23  }
    24  
    25  type DkgDiscussion struct {
    26  	Deal      *dkg.Deal
    27  	Responses []*dkg.Response
    28  }
    29  
    30  func (d *DkgDiscussion) GetCurrentStage() Stage {
    31  	if d.Deal == nil {
    32  		return StageStart
    33  	}
    34  	return StageDealReceived
    35  }