mirror of
https://github.com/luxfi/consensus.git
synced 2026-09-24 00:26:58 +00:00
19 lines
488 B
Go
19 lines
488 B
Go
package core
|
|
|
|
import "context"
|
|
|
|
// ID interface for block/vertex IDs
|
|
type ID interface{ ~[32]byte }
|
|
|
|
// Protocol represents a consensus protocol that can be plugged into engines
|
|
type Protocol[I comparable] interface {
|
|
// Initialize initializes the protocol
|
|
Initialize(ctx context.Context) error
|
|
|
|
// Step runs one poll/round of the protocol
|
|
Step(ctx context.Context) error
|
|
|
|
// Status returns the status of an item (e.g., {unknown, preferred, decided})
|
|
Status(id I) (string, error)
|
|
}
|