types

package
v0.0.0-...-d7dfbf7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FeaturePeerInformationReceive Backwards compatible, can be sent to all clients
	FeaturePeerInformationReceive = ProtocolFeature(iota)
	FeaturePeerInformationExchange
	FeaturePrunedBroadcast
	FeatureCompactBroadcast
	FeatureBlockNotify
)
View Source
const CurrentSoftwareId = SoftwareIdGoObserver
View Source
const SemanticVersionNone = 0
View Source
const SupportedProtocolVersion = ProtocolVersion_1_2

Variables

This section is empty.

Functions

func IsPeerVersionInformation

func IsPeerVersionInformation(addr netip.AddrPort) bool

Types

type MinerData

type MinerData struct {
	MajorVersion          uint8            `json:"major_version"`
	Height                uint64           `json:"height"`
	PrevId                types.Hash       `json:"prev_id"`
	SeedHash              types.Hash       `json:"seed_hash"`
	Difficulty            types.Difficulty `json:"difficulty"`
	MedianWeight          uint64           `json:"median_weight"`
	AlreadyGeneratedCoins uint64           `json:"already_generated_coins"`
	MedianTimestamp       uint64           `json:"median_timestamp"`
	TimeReceived          time.Time        `json:"time_received"`
	TxBacklog             mempool.Mempool  `json:"tx_backlog"`
}

type P2PoolBinaryBlockResult

type P2PoolBinaryBlockResult struct {
	Version int         `json:"version"`
	Blob    types.Bytes `json:"blob"`
	Error   string      `json:"error,omitempty"`
}

type P2PoolConnectionCheckInformation

type P2PoolConnectionCheckInformation[TipType any] struct {
	Address         string `json:"address"`
	Port            uint16 `json:"port"`
	ListenPort      uint16 `json:"listen_port"`
	PeerId          uint64 `json:"peer_id"`
	SoftwareId      string `json:"software_id"`
	SoftwareVersion string `json:"software_version"`
	ProtocolVersion string `json:"protocol_version"`
	ConnectionTime  uint64 `json:"connection_time"`
	Latency         uint64 `json:"latency"`
	LastActive      uint64 `json:"last_active"`
	Incoming        bool   `json:"incoming"`
	BroadcastTime   uint64 `json:"broadcast_time"`
	BroadcastHeight uint64 `json:"broadcast_height"`
	// Tip is a sidechain.PoolBlock
	Tip               TipType `json:"tip,omitempty"`
	Closed            bool    `json:"closed"`
	AlreadyConnected  bool    `json:"already_connected"`
	HandshakeComplete bool    `json:"handshake_complete"`
	Banned            bool    `json:"banned"`
	Error             string  `json:"error,omitempty"`
	BanError          string  `json:"ban_error,omitempty"`
}

type P2PoolServerPeerResult

type P2PoolServerPeerResult struct {
	PeerId          uint64 `json:"peer_id"`
	Incoming        bool   `json:"incoming"`
	Address         string `json:"address"`
	SoftwareId      string `json:"software_id"`
	SoftwareVersion string `json:"software_version"`
	ProtocolVersion string `json:"protocol_version"`
	ConnectionTime  uint64 `json:"connection_time"`
	ListenPort      uint32 `json:"listen_port"`
	Latency         uint64 `json:"latency"`
}

type P2PoolServerStatusResult

type P2PoolServerStatusResult struct {
	PeerId          uint64 `json:"peer_id"`
	SoftwareId      string `json:"software_id"`
	SoftwareVersion string `json:"software_version"`
	ProtocolVersion string `json:"protocol_version"`
	ListenPort      uint16 `json:"listen_port"`
}

type P2PoolSideChainStateResult

type P2PoolSideChainStateResult struct {
	TipHeight uint64                    `json:"tip_height"`
	TipId     types.Hash                `json:"tip_id"`
	Chain     []P2PoolBinaryBlockResult `json:"chain"`
	Uncles    []P2PoolBinaryBlockResult `json:"uncles"`
}

type P2PoolSideChainStatusResult

type P2PoolSideChainStatusResult struct {
	Synchronized         bool             `json:"synchronized"`
	Height               uint64           `json:"tip_height"`
	Id                   types.Hash       `json:"tip_id"`
	Difficulty           types.Difficulty `json:"difficulty"`
	CumulativeDifficulty types.Difficulty `json:"cumulative_difficulty"`
	Blocks               int              `json:"blocks"`
}

type P2PoolSpecialBinaryBlockResult

type P2PoolSpecialBinaryBlockResult struct {
	Version int         `json:"version"`
	Blob    types.Bytes `json:"blob"`
	Error   string      `json:"error,omitempty"`
}

type PeerVersionInformation

type PeerVersionInformation struct {
	Protocol        ProtocolVersion
	SoftwareVersion SoftwareVersion
	SoftwareId      SoftwareId
}

func (*PeerVersionInformation) String

func (i *PeerVersionInformation) String() string

func (*PeerVersionInformation) SupportsFeature

func (i *PeerVersionInformation) SupportsFeature(feature ProtocolFeature) bool

func (*PeerVersionInformation) ToAddrPort

func (i *PeerVersionInformation) ToAddrPort() netip.AddrPort

type ProtocolFeature

type ProtocolFeature int

ProtocolFeature List of features to check to not depend on hardcoded protocol versions. Use PeerVersionInformation.SupportsFeature() to query these.

type ProtocolVersion

type ProtocolVersion SemanticVersion
const (
	ProtocolVersion_0_0 ProtocolVersion = (0 << 16) | 0
	ProtocolVersion_1_0 ProtocolVersion = (1 << 16) | 0
	ProtocolVersion_1_1 ProtocolVersion = (1 << 16) | 1
	ProtocolVersion_1_2 ProtocolVersion = (1 << 16) | 2
)

func (ProtocolVersion) Major

func (v ProtocolVersion) Major() uint16

func (ProtocolVersion) Minor

func (v ProtocolVersion) Minor() uint16

func (ProtocolVersion) String

func (v ProtocolVersion) String() string

type SemanticVersion

type SemanticVersion uint32

func SemanticVersionFromString

func SemanticVersionFromString(version string) SemanticVersion

func (SemanticVersion) Major

func (v SemanticVersion) Major() uint16

func (SemanticVersion) Minor

func (v SemanticVersion) Minor() uint16

func (SemanticVersion) String

func (v SemanticVersion) String() string

type SoftwareId

type SoftwareId uint32
const (
	SoftwareIdP2Pool     SoftwareId = 0x00000000
	SoftwareIdGoObserver SoftwareId = 0x624F6F47 //GoOb, little endian
)

func (SoftwareId) String

func (c SoftwareId) String() string

type SoftwareVersion

type SoftwareVersion SemanticVersion
const CurrentSoftwareVersion SoftwareVersion = (3 << 16) | 0

func (SoftwareVersion) Major

func (v SoftwareVersion) Major() uint16

func (SoftwareVersion) Minor

func (v SoftwareVersion) Minor() uint16

func (SoftwareVersion) String

func (v SoftwareVersion) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL