github.com/koko1123/flow-go-1@v0.29.6/module/dkg_broker.go (about)

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