ceremonyclient/node/consensus/consensus_engine.go

52 lines
1.4 KiB
Go
Raw Normal View History

2023-09-03 23:47:09 +00:00
package consensus
import (
2023-09-25 02:43:35 +00:00
"crypto"
"source.quilibrium.com/quilibrium/monorepo/node/config"
2023-09-03 23:47:09 +00:00
"source.quilibrium.com/quilibrium/monorepo/node/execution"
2023-09-25 02:43:35 +00:00
"source.quilibrium.com/quilibrium/monorepo/node/keys"
"source.quilibrium.com/quilibrium/monorepo/node/protobufs"
2023-09-03 23:47:09 +00:00
)
type EngineState int
const (
EngineStateStopped EngineState = iota
EngineStateStarting
EngineStateLoading
EngineStateCollecting
EngineStateProving
EngineStatePublishing
EngineStateVerifying
EngineStateStopping
)
type ConsensusEngine interface {
Start() <-chan error
Stop(force bool) <-chan error
RegisterExecutor(exec execution.ExecutionEngine, frame uint64) <-chan error
UnregisterExecutor(name string, frame uint64, force bool) <-chan error
GetFrame() uint64
GetDifficulty() uint32
GetState() EngineState
GetFrameChannel() <-chan uint64
}
2023-09-25 02:43:35 +00:00
type DataConsensusEngine interface {
Start(filter []byte, seed []byte) <-chan error
Stop(force bool) <-chan error
RegisterExecutor(exec execution.ExecutionEngine, frame uint64) <-chan error
UnregisterExecutor(name string, frame uint64, force bool) <-chan error
GetFrame() uint64
GetDifficulty() uint32
GetState() EngineState
GetFrameChannel() <-chan *protobufs.ClockFrame
GetActiveFrame() *protobufs.ClockFrame
GetProvingKey(
engineConfig *config.EngineConfig,
) (crypto.Signer, keys.KeyType, []byte, []byte)
IsInProverTrie(key []byte) bool
GetPeerInfo() *protobufs.PeerInfoResponse
2023-09-25 02:43:35 +00:00
}