mirror of
https://github.com/luxfi/threshold.git
synced 2026-10-30 15:15:53 +00:00
37 lines
940 B
Go
37 lines
940 B
Go
package round
|
|
|
|
import (
|
|
"github.com/luxfi/threshold/pkg/party"
|
|
)
|
|
|
|
// Content represents the message, either broadcast or P2P returned by a round
|
|
// during finalization.
|
|
type Content interface {
|
|
RoundNumber() Number
|
|
}
|
|
|
|
// BroadcastContent wraps a Content, but also indicates whether this content
|
|
// requires reliable broadcast.
|
|
type BroadcastContent interface {
|
|
Content
|
|
Reliable() bool
|
|
}
|
|
|
|
// These structs can be embedded in a broadcast message as a way of
|
|
// 1. implementing BroadcastContent
|
|
// 2. indicate to the handler whether the content should be reliably broadcast
|
|
// When non-unanimous halting is acceptable, we can use the echo broadcast.
|
|
type (
|
|
ReliableBroadcastContent struct{}
|
|
NormalBroadcastContent struct{}
|
|
)
|
|
|
|
func (ReliableBroadcastContent) Reliable() bool { return true }
|
|
func (NormalBroadcastContent) Reliable() bool { return false }
|
|
|
|
type Message struct {
|
|
From, To party.ID
|
|
Broadcast bool
|
|
Content Content
|
|
}
|