-
Notifications
You must be signed in to change notification settings - Fork 179
/
dkg.go
44 lines (38 loc) · 1.07 KB
/
dkg.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
40
41
42
43
44
package messages
import (
"github.com/onflow/flow-go/crypto"
"github.com/onflow/flow-go/model/flow"
)
// DKGMessage is the type of message exchanged between DKG nodes.
type DKGMessage struct {
Orig uint64
Data []byte
DKGInstanceID string
}
// NewDKGMessage creates a new DKGMessage.
func NewDKGMessage(orig int, data []byte, dkgInstanceID string) DKGMessage {
return DKGMessage{
Orig: uint64(orig),
Data: data,
DKGInstanceID: dkgInstanceID,
}
}
// PrivDKGMessageIn is a wrapper around a DKGMessage containing the network ID
// of the sender.
type PrivDKGMessageIn struct {
DKGMessage
OriginID flow.Identifier
}
// PrivDKGMessageOut is a wrapper around a DKGMessage containing the network ID of
// the destination.
type PrivDKGMessageOut struct {
DKGMessage
DestID flow.Identifier
}
// BroadcastDKGMessage is a wrapper around a DKGMessage intended for broadcasting.
// It contains a signature of the DKGMessage signed with the staking key of the
// sender.
type BroadcastDKGMessage struct {
DKGMessage
Signature crypto.Signature
}