2020-10-20 18:18:36 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2020-10-20 18:18:36 +00:00
|
|
|
type Message struct {
|
2020-11-15 13:46:58 +00:00
|
|
|
Type MessageType `json:"type"`
|
|
|
|
Payload ConsensusMessage `json:"payload"`
|
|
|
|
From peer.ID `json:"-"`
|
2020-10-20 18:18:36 +00:00
|
|
|
}
|