mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-05-29 10:16:45 +00:00
42 lines
991 B
Go
42 lines
991 B
Go
package externalapi
|
|
|
|
import "fmt"
|
|
|
|
// Each of the following represent one of the possible sync
|
|
// states of the consensus
|
|
const (
|
|
SyncStateRelay SyncState = iota
|
|
SyncStateMissingGenesis
|
|
SyncStateHeadersFirst
|
|
SyncStateMissingUTXOSet
|
|
SyncStateMissingBlockBodies
|
|
)
|
|
|
|
// SyncState represents the current sync state of the consensus
|
|
type SyncState uint8
|
|
|
|
func (s SyncState) String() string {
|
|
switch s {
|
|
case SyncStateRelay:
|
|
return "SyncStateRelay"
|
|
case SyncStateMissingGenesis:
|
|
return "SyncStateMissingGenesis"
|
|
case SyncStateHeadersFirst:
|
|
return "SyncStateHeadersFirst"
|
|
case SyncStateMissingUTXOSet:
|
|
return "SyncStateMissingUTXOSet"
|
|
case SyncStateMissingBlockBodies:
|
|
return "SyncStateMissingBlockBodies"
|
|
}
|
|
|
|
return fmt.Sprintf("<unknown state (%d)>", s)
|
|
}
|
|
|
|
// SyncInfo holds info about the current sync state of the consensus
|
|
type SyncInfo struct {
|
|
State SyncState
|
|
IBDRootUTXOBlockHash *DomainHash
|
|
HeaderCount uint64
|
|
BlockCount uint64
|
|
}
|