github.com/koko1123/flow-go-1@v0.29.6/model/messages/dkg.go (about)

     1  package messages
     2  
     3  import (
     4  	"github.com/onflow/flow-go/crypto"
     5  	"github.com/koko1123/flow-go-1/model/flow"
     6  )
     7  
     8  // DKGMessage is the type of message exchanged between DKG nodes.
     9  type DKGMessage struct {
    10  	Data          []byte
    11  	DKGInstanceID string
    12  }
    13  
    14  // NewDKGMessage creates a new DKGMessage.
    15  func NewDKGMessage(data []byte, dkgInstanceID string) DKGMessage {
    16  	return DKGMessage{
    17  		Data:          data,
    18  		DKGInstanceID: dkgInstanceID,
    19  	}
    20  }
    21  
    22  // PrivDKGMessageIn is a wrapper around a DKGMessage containing the network ID
    23  // of the sender.
    24  type PrivDKGMessageIn struct {
    25  	DKGMessage
    26  	CommitteeMemberIndex uint64 // CommitteeMemberIndex field is set when the message arrives at the Broker
    27  	OriginID             flow.Identifier
    28  }
    29  
    30  // PrivDKGMessageOut is a wrapper around a DKGMessage containing the network ID of
    31  // the destination.
    32  type PrivDKGMessageOut struct {
    33  	DKGMessage
    34  	DestID flow.Identifier
    35  }
    36  
    37  // BroadcastDKGMessage is a wrapper around a DKGMessage intended for broadcasting.
    38  // It contains a signature of the DKGMessage signed with the staking key of the
    39  // sender. When the DKG contract receives BroadcastDKGMessage' it will attach the
    40  // NodeID of the sender, we then add this field to the BroadcastDKGMessage when reading broadcast messages.
    41  type BroadcastDKGMessage struct {
    42  	DKGMessage
    43  	CommitteeMemberIndex uint64          `json:"-"` // CommitteeMemberIndex field is set when reading broadcast messages using the NodeID to find the index of the sender in the DKG committee
    44  	NodeID               flow.Identifier `json:"-"` // NodeID field is added when reading broadcast messages from the DKG contract, this field is ignored when sending broadcast messages
    45  	Signature            crypto.Signature
    46  }