github.com/onflow/flow-go@v0.33.17/module/dkg_broker.go (about)

     1  package module
     2  
     3  import (
     4  	"github.com/onflow/flow-go/crypto"
     5  	"github.com/onflow/flow-go/model/flow"
     6  	"github.com/onflow/flow-go/model/messages"
     7  )
     8  
     9  // DKGBroker extends the crypto.DKGProcessor interface with methods that enable
    10  // a controller to access the channel of incoming messages, and actively fetch
    11  // new DKG broadcast messages.
    12  type DKGBroker interface {
    13  	crypto.DKGProcessor
    14  
    15  	// GetIndex returns the index of this node in the DKG committee list.
    16  	GetIndex() int
    17  
    18  	// GetPrivateMsgCh returns the channel through which a user can receive
    19  	// incoming private DKGMessages.
    20  	GetPrivateMsgCh() <-chan messages.PrivDKGMessageIn
    21  
    22  	// GetBroadcastMsgCh returns the channel through which a user can receive
    23  	// incoming broadcast DKGMessages.
    24  	GetBroadcastMsgCh() <-chan messages.BroadcastDKGMessage
    25  
    26  	// Poll instructs the broker to actively fetch broadcast messages (ex. read
    27  	// from DKG smart contract). The messages will be forwarded through the
    28  	// broker's message channel (cf. GetMsgCh). The method does not return until
    29  	// all received messages are processed by the consumer.
    30  	Poll(referenceBlock flow.Identifier) error
    31  
    32  	// SubmitResult instructs the broker to publish the results of the DKG run
    33  	// (ex. publish to DKG smart contract).
    34  	SubmitResult(crypto.PublicKey, []crypto.PublicKey) error
    35  
    36  	// Shutdown causes the broker to stop listening and forwarding messages.
    37  	Shutdown()
    38  }