dione/consensus/types/message.go

32 lines
628 B
Go
Raw Normal View History

package types
2020-11-15 13:46:58 +00:00
import (
"github.com/Secured-Finance/dione/types"
2020-11-15 13:46:58 +00:00
"github.com/libp2p/go-libp2p-core/peer"
)
type MessageType uint8
const (
MessageTypeUnknown = MessageType(iota)
MessageTypePrePrepare
MessageTypePrepare
MessageTypeCommit
)
type ConsensusMessage struct {
_ struct{} `cbor:",toarray" hash:"-"`
2020-11-15 13:46:58 +00:00
ConsensusID string
Signature []byte `hash:"-"`
2020-11-15 13:46:58 +00:00
RequestID string
CallbackAddress string
Task types.DioneTask
2020-11-15 13:46:58 +00:00
}
type Message struct {
Type MessageType `cbor:"1,keyasint"`
Payload ConsensusMessage `cbor:"2,keyasint"`
From peer.ID `cbor:"-"`
}