github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/module/dkg_broker.go (about)

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