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