dione/models/message.go

30 lines
505 B
Go
Raw Normal View History

package models
2020-11-15 13:46:58 +00:00
import (
"github.com/libp2p/go-libp2p-core/peer"
)
type MessageType uint8
const (
MessageTypeUnknown = MessageType(iota)
MessageTypePrePrepare
MessageTypePrepare
MessageTypeCommit
)
type ConsensusMessage struct {
ConsensusID string
2020-11-18 18:14:56 +00:00
Signature []byte
2020-11-15 13:46:58 +00:00
RequestID string
CallbackAddress string
Data string
}
type Message struct {
2020-11-15 13:46:58 +00:00
Type MessageType `json:"type"`
Payload ConsensusMessage `json:"payload"`
From peer.ID `json:"-"`
}