Documentation
¶
Index ¶
- Constants
- Variables
- type BlockAddedNotificationMessage
- type EstimateNetworkHashesPerSecondRequestMessage
- func (msg *EstimateNetworkHashesPerSecondRequestMessage) Command() MessageCommand
- func (b *EstimateNetworkHashesPerSecondRequestMessage) MessageNumber() uint64
- func (b *EstimateNetworkHashesPerSecondRequestMessage) ReceivedAt() time.Time
- func (b *EstimateNetworkHashesPerSecondRequestMessage) SetMessageNumber(messageNumber uint64)
- func (b *EstimateNetworkHashesPerSecondRequestMessage) SetReceivedAt(receivedAt time.Time)
- type EstimateNetworkHashesPerSecondResponseMessage
- func (msg *EstimateNetworkHashesPerSecondResponseMessage) Command() MessageCommand
- func (b *EstimateNetworkHashesPerSecondResponseMessage) MessageNumber() uint64
- func (b *EstimateNetworkHashesPerSecondResponseMessage) ReceivedAt() time.Time
- func (b *EstimateNetworkHashesPerSecondResponseMessage) SetMessageNumber(messageNumber uint64)
- func (b *EstimateNetworkHashesPerSecondResponseMessage) SetReceivedAt(receivedAt time.Time)
- type GetBalanceByAddressRequestMessage
- func (msg *GetBalanceByAddressRequestMessage) Command() MessageCommand
- func (b *GetBalanceByAddressRequestMessage) MessageNumber() uint64
- func (b *GetBalanceByAddressRequestMessage) ReceivedAt() time.Time
- func (b *GetBalanceByAddressRequestMessage) SetMessageNumber(messageNumber uint64)
- func (b *GetBalanceByAddressRequestMessage) SetReceivedAt(receivedAt time.Time)
- type GetBalanceByAddressResponseMessage
- func (msg *GetBalanceByAddressResponseMessage) Command() MessageCommand
- func (b *GetBalanceByAddressResponseMessage) MessageNumber() uint64
- func (b *GetBalanceByAddressResponseMessage) ReceivedAt() time.Time
- func (b *GetBalanceByAddressResponseMessage) SetMessageNumber(messageNumber uint64)
- func (b *GetBalanceByAddressResponseMessage) SetReceivedAt(receivedAt time.Time)
- type GetBlockDAGInfoRequestMessage
- func (msg *GetBlockDAGInfoRequestMessage) Command() MessageCommand
- func (b *GetBlockDAGInfoRequestMessage) MessageNumber() uint64
- func (b *GetBlockDAGInfoRequestMessage) ReceivedAt() time.Time
- func (b *GetBlockDAGInfoRequestMessage) SetMessageNumber(messageNumber uint64)
- func (b *GetBlockDAGInfoRequestMessage) SetReceivedAt(receivedAt time.Time)
- type GetBlockDAGInfoResponseMessage
- func (msg *GetBlockDAGInfoResponseMessage) Command() MessageCommand
- func (b *GetBlockDAGInfoResponseMessage) MessageNumber() uint64
- func (b *GetBlockDAGInfoResponseMessage) ReceivedAt() time.Time
- func (b *GetBlockDAGInfoResponseMessage) SetMessageNumber(messageNumber uint64)
- func (b *GetBlockDAGInfoResponseMessage) SetReceivedAt(receivedAt time.Time)
- type GetBlockTemplateRequestMessage
- func (msg *GetBlockTemplateRequestMessage) Command() MessageCommand
- func (b *GetBlockTemplateRequestMessage) MessageNumber() uint64
- func (b *GetBlockTemplateRequestMessage) ReceivedAt() time.Time
- func (b *GetBlockTemplateRequestMessage) SetMessageNumber(messageNumber uint64)
- func (b *GetBlockTemplateRequestMessage) SetReceivedAt(receivedAt time.Time)
- type GetBlockTemplateResponseMessage
- func (msg *GetBlockTemplateResponseMessage) Command() MessageCommand
- func (b *GetBlockTemplateResponseMessage) MessageNumber() uint64
- func (b *GetBlockTemplateResponseMessage) ReceivedAt() time.Time
- func (b *GetBlockTemplateResponseMessage) SetMessageNumber(messageNumber uint64)
- func (b *GetBlockTemplateResponseMessage) SetReceivedAt(receivedAt time.Time)
- type GetInfoRequestMessage
- func (msg *GetInfoRequestMessage) Command() MessageCommand
- func (b *GetInfoRequestMessage) MessageNumber() uint64
- func (b *GetInfoRequestMessage) ReceivedAt() time.Time
- func (b *GetInfoRequestMessage) SetMessageNumber(messageNumber uint64)
- func (b *GetInfoRequestMessage) SetReceivedAt(receivedAt time.Time)
- type GetInfoResponseMessage
- func (msg *GetInfoResponseMessage) Command() MessageCommand
- func (b *GetInfoResponseMessage) MessageNumber() uint64
- func (b *GetInfoResponseMessage) ReceivedAt() time.Time
- func (b *GetInfoResponseMessage) SetMessageNumber(messageNumber uint64)
- func (b *GetInfoResponseMessage) SetReceivedAt(receivedAt time.Time)
- type Message
- type MessageCommand
- type MessageError
- type MetchainNet
- type MsgAddresses
- type MsgReady
- type MsgReject
- type MsgRequestAddresses
- type MsgVerAck
- type MsgVersion
- func (msg *MsgVersion) AddService(service ServiceFlag)
- func (msg *MsgVersion) AddUserAgent(name string, version string, comments ...string)
- func (msg *MsgVersion) Command() MessageCommand
- func (msg *MsgVersion) HasService(service ServiceFlag) bool
- func (b *MsgVersion) MessageNumber() uint64
- func (b *MsgVersion) ReceivedAt() time.Time
- func (b *MsgVersion) SetMessageNumber(messageNumber uint64)
- func (b *MsgVersion) SetReceivedAt(receivedAt time.Time)
- type NetAddress
- type NewBlockTemplateNotificationMessage
- func (msg *NewBlockTemplateNotificationMessage) Command() MessageCommand
- func (b *NewBlockTemplateNotificationMessage) MessageNumber() uint64
- func (b *NewBlockTemplateNotificationMessage) ReceivedAt() time.Time
- func (b *NewBlockTemplateNotificationMessage) SetMessageNumber(messageNumber uint64)
- func (b *NewBlockTemplateNotificationMessage) SetReceivedAt(receivedAt time.Time)
- type NotifyNewBlockTemplateRequestMessage
- func (msg *NotifyNewBlockTemplateRequestMessage) Command() MessageCommand
- func (b *NotifyNewBlockTemplateRequestMessage) MessageNumber() uint64
- func (b *NotifyNewBlockTemplateRequestMessage) ReceivedAt() time.Time
- func (b *NotifyNewBlockTemplateRequestMessage) SetMessageNumber(messageNumber uint64)
- func (b *NotifyNewBlockTemplateRequestMessage) SetReceivedAt(receivedAt time.Time)
- type NotifyNewBlockTemplateResponseMessage
- func (msg *NotifyNewBlockTemplateResponseMessage) Command() MessageCommand
- func (b *NotifyNewBlockTemplateResponseMessage) MessageNumber() uint64
- func (b *NotifyNewBlockTemplateResponseMessage) ReceivedAt() time.Time
- func (b *NotifyNewBlockTemplateResponseMessage) SetMessageNumber(messageNumber uint64)
- func (b *NotifyNewBlockTemplateResponseMessage) SetReceivedAt(receivedAt time.Time)
- type RPCBlock
- type RPCBlockHeader
- type RPCBlockLevelParents
- type RPCBlockVerboseData
- type RPCError
- type RejectReason
- type ServiceFlag
- type SubmitBlockRequestMessage
- func (msg *SubmitBlockRequestMessage) Command() MessageCommand
- func (b *SubmitBlockRequestMessage) MessageNumber() uint64
- func (b *SubmitBlockRequestMessage) ReceivedAt() time.Time
- func (b *SubmitBlockRequestMessage) SetMessageNumber(messageNumber uint64)
- func (b *SubmitBlockRequestMessage) SetReceivedAt(receivedAt time.Time)
- type SubmitBlockResponseMessage
- func (msg *SubmitBlockResponseMessage) Command() MessageCommand
- func (b *SubmitBlockResponseMessage) MessageNumber() uint64
- func (b *SubmitBlockResponseMessage) ReceivedAt() time.Time
- func (b *SubmitBlockResponseMessage) SetMessageNumber(messageNumber uint64)
- func (b *SubmitBlockResponseMessage) SetReceivedAt(receivedAt time.Time)
Constants ¶
const ( // DefaultServices describes the default services that are supported by // the server. DefaultServices = SFNodeNetwork | SFNodeBloom | SFNodeCF )
const MaxAddressesPerMsg = 1000
Variables ¶
var DefaultUserAgent = fmt.Sprintf("/Metchaind:%s/", version.Version())
var RPCMessageCommandToString = map[MessageCommand]string{}
Add all RPC commands here
Functions ¶
This section is empty.
Types ¶
type BlockAddedNotificationMessage ¶
type BlockAddedNotificationMessage struct { Block *RPCBlock // contains filtered or unexported fields }
BlockAddedNotificationMessage is an appmessage corresponding to its respective RPC message
func NewBlockAddedNotificationMessage ¶
func NewBlockAddedNotificationMessage(block *RPCBlock) *BlockAddedNotificationMessage
NewBlockAddedNotificationMessage returns a instance of the message
func (*BlockAddedNotificationMessage) MessageNumber ¶
func (b *BlockAddedNotificationMessage) MessageNumber() uint64
func (*BlockAddedNotificationMessage) ReceivedAt ¶
func (*BlockAddedNotificationMessage) SetMessageNumber ¶
func (b *BlockAddedNotificationMessage) SetMessageNumber(messageNumber uint64)
func (*BlockAddedNotificationMessage) SetReceivedAt ¶
type EstimateNetworkHashesPerSecondRequestMessage ¶
type EstimateNetworkHashesPerSecondRequestMessage struct { StartHash string WindowSize uint32 // contains filtered or unexported fields }
EstimateNetworkHashesPerSecondRequestMessage is an appmessage corresponding to its respective RPC message
func NewEstimateNetworkHashesPerSecondRequestMessage ¶
func NewEstimateNetworkHashesPerSecondRequestMessage(startHash string, windowSize uint32) *EstimateNetworkHashesPerSecondRequestMessage
NewEstimateNetworkHashesPerSecondRequestMessage returns a instance of the message
func (*EstimateNetworkHashesPerSecondRequestMessage) Command ¶
func (msg *EstimateNetworkHashesPerSecondRequestMessage) Command() MessageCommand
Command returns the protocol command string for the message
func (*EstimateNetworkHashesPerSecondRequestMessage) MessageNumber ¶
func (b *EstimateNetworkHashesPerSecondRequestMessage) MessageNumber() uint64
func (*EstimateNetworkHashesPerSecondRequestMessage) ReceivedAt ¶
func (*EstimateNetworkHashesPerSecondRequestMessage) SetMessageNumber ¶
func (b *EstimateNetworkHashesPerSecondRequestMessage) SetMessageNumber(messageNumber uint64)
func (*EstimateNetworkHashesPerSecondRequestMessage) SetReceivedAt ¶
type EstimateNetworkHashesPerSecondResponseMessage ¶
type EstimateNetworkHashesPerSecondResponseMessage struct { NetworkHashesPerSecond uint64 Error *RPCError // contains filtered or unexported fields }
EstimateNetworkHashesPerSecondResponseMessage is an appmessage corresponding to its respective RPC message
func NewEstimateNetworkHashesPerSecondResponseMessage ¶
func NewEstimateNetworkHashesPerSecondResponseMessage(networkHashesPerSecond uint64) *EstimateNetworkHashesPerSecondResponseMessage
NewEstimateNetworkHashesPerSecondResponseMessage returns a instance of the message
func (*EstimateNetworkHashesPerSecondResponseMessage) Command ¶
func (msg *EstimateNetworkHashesPerSecondResponseMessage) Command() MessageCommand
Command returns the protocol command string for the message
func (*EstimateNetworkHashesPerSecondResponseMessage) MessageNumber ¶
func (b *EstimateNetworkHashesPerSecondResponseMessage) MessageNumber() uint64
func (*EstimateNetworkHashesPerSecondResponseMessage) ReceivedAt ¶
func (*EstimateNetworkHashesPerSecondResponseMessage) SetMessageNumber ¶
func (b *EstimateNetworkHashesPerSecondResponseMessage) SetMessageNumber(messageNumber uint64)
func (*EstimateNetworkHashesPerSecondResponseMessage) SetReceivedAt ¶
type GetBalanceByAddressRequestMessage ¶
type GetBalanceByAddressRequestMessage struct { Address string // contains filtered or unexported fields }
GetBalanceByAddressRequestMessage is an appmessage corresponding to its respective RPC message
func NewGetBalanceByAddressRequest ¶
func NewGetBalanceByAddressRequest(address string) *GetBalanceByAddressRequestMessage
NewGetBalanceByAddressRequest returns a instance of the message
func (*GetBalanceByAddressRequestMessage) Command ¶
func (msg *GetBalanceByAddressRequestMessage) Command() MessageCommand
Command returns the protocol command string for the message
func (*GetBalanceByAddressRequestMessage) MessageNumber ¶
func (b *GetBalanceByAddressRequestMessage) MessageNumber() uint64
func (*GetBalanceByAddressRequestMessage) ReceivedAt ¶
func (*GetBalanceByAddressRequestMessage) SetMessageNumber ¶
func (b *GetBalanceByAddressRequestMessage) SetMessageNumber(messageNumber uint64)
func (*GetBalanceByAddressRequestMessage) SetReceivedAt ¶
type GetBalanceByAddressResponseMessage ¶
type GetBalanceByAddressResponseMessage struct { Balance uint64 Error *RPCError // contains filtered or unexported fields }
GetBalanceByAddressResponseMessage is an appmessage corresponding to its respective RPC message
func NewGetBalanceByAddressResponse ¶
func NewGetBalanceByAddressResponse(Balance uint64) *GetBalanceByAddressResponseMessage
NewGetBalanceByAddressResponse returns an instance of the message
func (*GetBalanceByAddressResponseMessage) Command ¶
func (msg *GetBalanceByAddressResponseMessage) Command() MessageCommand
Command returns the protocol command string for the message
func (*GetBalanceByAddressResponseMessage) MessageNumber ¶
func (b *GetBalanceByAddressResponseMessage) MessageNumber() uint64
func (*GetBalanceByAddressResponseMessage) ReceivedAt ¶
func (*GetBalanceByAddressResponseMessage) SetMessageNumber ¶
func (b *GetBalanceByAddressResponseMessage) SetMessageNumber(messageNumber uint64)
func (*GetBalanceByAddressResponseMessage) SetReceivedAt ¶
type GetBlockDAGInfoRequestMessage ¶
type GetBlockDAGInfoRequestMessage struct {
// contains filtered or unexported fields
}
GetBlockDAGInfoRequestMessage is an appmessage corresponding to its respective RPC message
func NewGetBlockDAGInfoRequestMessage ¶
func NewGetBlockDAGInfoRequestMessage() *GetBlockDAGInfoRequestMessage
NewGetBlockDAGInfoRequestMessage returns a instance of the message
func (*GetBlockDAGInfoRequestMessage) Command ¶
func (msg *GetBlockDAGInfoRequestMessage) Command() MessageCommand
Command returns the protocol command string for the message
func (*GetBlockDAGInfoRequestMessage) MessageNumber ¶
func (b *GetBlockDAGInfoRequestMessage) MessageNumber() uint64
func (*GetBlockDAGInfoRequestMessage) ReceivedAt ¶
func (*GetBlockDAGInfoRequestMessage) SetMessageNumber ¶
func (b *GetBlockDAGInfoRequestMessage) SetMessageNumber(messageNumber uint64)
func (*GetBlockDAGInfoRequestMessage) SetReceivedAt ¶
type GetBlockDAGInfoResponseMessage ¶
type GetBlockDAGInfoResponseMessage struct { NetworkName string BlockCount uint64 HeaderCount uint64 TipHashes []string VirtualParentHashes []string Difficulty float64 PastMedianTime int64 PruningPointHash string VirtualDAAScore uint64 Error *RPCError // contains filtered or unexported fields }
GetBlockDAGInfoResponseMessage is an appmessage corresponding to its respective RPC message
func NewGetBlockDAGInfoResponseMessage ¶
func NewGetBlockDAGInfoResponseMessage() *GetBlockDAGInfoResponseMessage
NewGetBlockDAGInfoResponseMessage returns a instance of the message
func (*GetBlockDAGInfoResponseMessage) Command ¶
func (msg *GetBlockDAGInfoResponseMessage) Command() MessageCommand
Command returns the protocol command string for the message
func (*GetBlockDAGInfoResponseMessage) MessageNumber ¶
func (b *GetBlockDAGInfoResponseMessage) MessageNumber() uint64
func (*GetBlockDAGInfoResponseMessage) ReceivedAt ¶
func (*GetBlockDAGInfoResponseMessage) SetMessageNumber ¶
func (b *GetBlockDAGInfoResponseMessage) SetMessageNumber(messageNumber uint64)
func (*GetBlockDAGInfoResponseMessage) SetReceivedAt ¶
type GetBlockTemplateRequestMessage ¶
type GetBlockTemplateRequestMessage struct { PayAddress string ExtraData string // contains filtered or unexported fields }
GetBlockTemplateRequestMessage is an appmessage corresponding to its respective RPC message
func NewGetBlockTemplateRequestMessage ¶
func NewGetBlockTemplateRequestMessage(payAddress, extraData string) *GetBlockTemplateRequestMessage
NewGetBlockTemplateRequestMessage returns a instance of the message
func (*GetBlockTemplateRequestMessage) Command ¶
func (msg *GetBlockTemplateRequestMessage) Command() MessageCommand
Command returns the protocol command string for the message
func (*GetBlockTemplateRequestMessage) MessageNumber ¶
func (b *GetBlockTemplateRequestMessage) MessageNumber() uint64
func (*GetBlockTemplateRequestMessage) ReceivedAt ¶
func (*GetBlockTemplateRequestMessage) SetMessageNumber ¶
func (b *GetBlockTemplateRequestMessage) SetMessageNumber(messageNumber uint64)
func (*GetBlockTemplateRequestMessage) SetReceivedAt ¶
type GetBlockTemplateResponseMessage ¶
type GetBlockTemplateResponseMessage struct { Block *RPCBlock IsSynced bool Error *RPCError // contains filtered or unexported fields }
GetBlockTemplateResponseMessage is an appmessage corresponding to its respective RPC message
func NewGetBlockTemplateResponseMessage ¶
func NewGetBlockTemplateResponseMessage(block *RPCBlock, isSynced bool) *GetBlockTemplateResponseMessage
NewGetBlockTemplateResponseMessage returns a instance of the message
func (*GetBlockTemplateResponseMessage) Command ¶
func (msg *GetBlockTemplateResponseMessage) Command() MessageCommand
Command returns the protocol command string for the message
func (*GetBlockTemplateResponseMessage) MessageNumber ¶
func (b *GetBlockTemplateResponseMessage) MessageNumber() uint64
func (*GetBlockTemplateResponseMessage) ReceivedAt ¶
func (*GetBlockTemplateResponseMessage) SetMessageNumber ¶
func (b *GetBlockTemplateResponseMessage) SetMessageNumber(messageNumber uint64)
func (*GetBlockTemplateResponseMessage) SetReceivedAt ¶
type GetInfoRequestMessage ¶
type GetInfoRequestMessage struct {
// contains filtered or unexported fields
}
GetInfoRequestMessage is an appmessage corresponding to its respective RPC message
func NewGetInfoRequestMessage ¶
func NewGetInfoRequestMessage() *GetInfoRequestMessage
NewGetInfoRequestMessage returns a instance of the message
func (*GetInfoRequestMessage) Command ¶
func (msg *GetInfoRequestMessage) Command() MessageCommand
Command returns the protocol command string for the message
func (*GetInfoRequestMessage) MessageNumber ¶
func (b *GetInfoRequestMessage) MessageNumber() uint64
func (*GetInfoRequestMessage) ReceivedAt ¶
func (*GetInfoRequestMessage) SetMessageNumber ¶
func (b *GetInfoRequestMessage) SetMessageNumber(messageNumber uint64)
func (*GetInfoRequestMessage) SetReceivedAt ¶
type GetInfoResponseMessage ¶
type GetInfoResponseMessage struct { P2PID string MempoolSize uint64 ServerVersion string IsUtxoIndexed bool IsSynced bool Error *RPCError // contains filtered or unexported fields }
GetInfoResponseMessage is an appmessage corresponding to its respective RPC message
func NewGetInfoResponseMessage ¶
func NewGetInfoResponseMessage(p2pID string, mempoolSize uint64, serverVersion string, isUtxoIndexed bool, isSynced bool) *GetInfoResponseMessage
NewGetInfoResponseMessage returns a instance of the message
func (*GetInfoResponseMessage) Command ¶
func (msg *GetInfoResponseMessage) Command() MessageCommand
Command returns the protocol command string for the message
func (*GetInfoResponseMessage) MessageNumber ¶
func (b *GetInfoResponseMessage) MessageNumber() uint64
func (*GetInfoResponseMessage) ReceivedAt ¶
func (*GetInfoResponseMessage) SetMessageNumber ¶
func (b *GetInfoResponseMessage) SetMessageNumber(messageNumber uint64)
func (*GetInfoResponseMessage) SetReceivedAt ¶
type MessageCommand ¶
type MessageCommand uint32
MessageCommand is a number in the header of a message that represents its type.
const ( // protocol CmdVersion MessageCommand = iota CmdVerAck CmdRequestAddresses CmdAddresses CmdReady CmdReject CmdNotifyNewBlockTemplateResponseMessage CmdNewBlockTemplateNotificationMessage CmdNotifyNewBlockTemplateRequestMessage CmdBlock CmdGetBlockTemplateRequestMessage CmdSubmitBlockResponseMessage CmdSubmitBlockRequestMessage CmdGetBlockTemplateResponseMessage CmdGetBlockDAGInfoResponseMessage CmdGetBlockDAGInfoRequestMessage CmdGetBalanceByAddressResponseMessage CmdGetBalanceByAddressRequestMessage CmdEstimateNetworkHashesPerSecondResponseMessage CmdEstimateNetworkHashesPerSecondRequestMessage //RPC CmdGetInfoRequestMessage CmdGetInfoResponseMessage )
type MessageError ¶
type MessageError struct { Func string // Function name Description string // Human readable description of the issue }
MessageError describes an issue with a message. An example of some potential issues are messages from the wrong Metchain network, invalid commands, mismatched checksums, and exceeding max payloads.
This provides a mechanism for the caller to type assert the error to differentiate between general io errors such as io.EOF and issues that resulted from malformed messages.
func (*MessageError) Error ¶
func (e *MessageError) Error() string
Error satisfies the error interface and prints human-readable errors.
type MetchainNet ¶
type MetchainNet uint32
const ( Mainnet MetchainNet = 0x3ddcf71d MaxInvPerMsg = 1 << 17 )
type MsgAddresses ¶
type MsgAddresses struct { AddressList []*NetAddress // contains filtered or unexported fields }
MsgAddresses implements the Message interface and represents a Metchain Addresses message.
func NewMsgAddresses ¶
func NewMsgAddresses(addressList []*NetAddress) *MsgAddresses
func (*MsgAddresses) Command ¶
func (msg *MsgAddresses) Command() MessageCommand
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgAddresses) MessageNumber ¶
func (b *MsgAddresses) MessageNumber() uint64
func (*MsgAddresses) ReceivedAt ¶
func (*MsgAddresses) SetMessageNumber ¶
func (b *MsgAddresses) SetMessageNumber(messageNumber uint64)
func (*MsgAddresses) SetReceivedAt ¶
type MsgReady ¶
type MsgReady struct {
// contains filtered or unexported fields
}
MsgReady implements the Message interface and represents a Metchain Ready message. It is used to notify that the peer is ready to receive messages.
This message has no payload.
func NewMsgReady ¶
func NewMsgReady() *MsgReady
NewMsgReady returns a new Metchain Ready message that conforms to the Message interface.
func (*MsgReady) Command ¶
func (msg *MsgReady) Command() MessageCommand
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgReady) MessageNumber ¶
func (b *MsgReady) MessageNumber() uint64
func (*MsgReady) ReceivedAt ¶
func (*MsgReady) SetMessageNumber ¶
func (b *MsgReady) SetMessageNumber(messageNumber uint64)
func (*MsgReady) SetReceivedAt ¶
type MsgReject ¶
type MsgReject struct { Reason string // contains filtered or unexported fields }
MsgReject implements the Message interface and represents a Metchain Reject message. It is used to notify peers why they are banned.
func NewMsgReject ¶
NewMsgReject returns a new Metchain Reject message that conforms to the Message interface.
func (*MsgReject) Command ¶
func (msg *MsgReject) Command() MessageCommand
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgReject) MessageNumber ¶
func (b *MsgReject) MessageNumber() uint64
func (*MsgReject) ReceivedAt ¶
func (*MsgReject) SetMessageNumber ¶
func (b *MsgReject) SetMessageNumber(messageNumber uint64)
func (*MsgReject) SetReceivedAt ¶
type MsgRequestAddresses ¶
type MsgRequestAddresses struct { IncludeAllSubnetworks bool SubnetworkID *external.DomainSubnetworkID // contains filtered or unexported fields }
MsgRequestAddresses implements the Message interface and represents a Metchain RequestAddresses message. It is used to request a list of known active peers on the network from a peer to help identify potential nodes. The list is returned via one or more addr messages (MsgAddresses).
This message has no payload.
func NewMsgRequestAddresses ¶
func NewMsgRequestAddresses(includeAllSubnetworks bool, subnetworkID *external.DomainSubnetworkID) *MsgRequestAddresses
NewMsgRequestAddresses returns a new Metchain RequestAddresses message that conforms to the Message interface. See MsgRequestAddresses for details.
func (*MsgRequestAddresses) Command ¶
func (msg *MsgRequestAddresses) Command() MessageCommand
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgRequestAddresses) MessageNumber ¶
func (b *MsgRequestAddresses) MessageNumber() uint64
func (*MsgRequestAddresses) ReceivedAt ¶
func (*MsgRequestAddresses) SetMessageNumber ¶
func (b *MsgRequestAddresses) SetMessageNumber(messageNumber uint64)
func (*MsgRequestAddresses) SetReceivedAt ¶
type MsgVerAck ¶
type MsgVerAck struct {
// contains filtered or unexported fields
}
func (*MsgVerAck) Command ¶
func (msg *MsgVerAck) Command() MessageCommand
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgVerAck) MessageNumber ¶
func (b *MsgVerAck) MessageNumber() uint64
func (*MsgVerAck) ReceivedAt ¶
func (*MsgVerAck) SetMessageNumber ¶
func (b *MsgVerAck) SetMessageNumber(messageNumber uint64)
func (*MsgVerAck) SetReceivedAt ¶
type MsgVersion ¶
type MsgVersion struct { // Version of the protocol the node is using. ProtocolVersion uint32 // The peer's network (mainnet, testnet, etc.) Network string // Bitfield which identifies the enabled services. Services ServiceFlag // Time the message was generated. This is encoded as an int64 on the appmessage. Timestamp mstime.Time // Address of the local peer. Address *NetAddress // The peer unique ID ID *id.ID // The user agent that generated messsage. This is a encoded as a varString // on the appmessage. This has a max length of MaxUserAgentLen. UserAgent string // Don't announce transactions to peer. DisableRelayTx bool // The subnetwork of the generator of the version message. Should be nil in full nodes SubnetworkID *external.DomainSubnetworkID // contains filtered or unexported fields }
func NewMsgVersion ¶
func NewMsgVersion(addr *NetAddress, id *id.ID, network string, subnetworkID *external.DomainSubnetworkID, protocolVersion uint32) *MsgVersion
func (*MsgVersion) AddService ¶
func (msg *MsgVersion) AddService(service ServiceFlag)
AddService adds service as a supported service by the peer generating the message.
func (*MsgVersion) AddUserAgent ¶
func (msg *MsgVersion) AddUserAgent(name string, version string, comments ...string)
func (*MsgVersion) Command ¶
func (msg *MsgVersion) Command() MessageCommand
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgVersion) HasService ¶
func (msg *MsgVersion) HasService(service ServiceFlag) bool
HasService returns whether the specified service is supported by the peer that generated the message.
func (*MsgVersion) MessageNumber ¶
func (b *MsgVersion) MessageNumber() uint64
func (*MsgVersion) ReceivedAt ¶
func (*MsgVersion) SetMessageNumber ¶
func (b *MsgVersion) SetMessageNumber(messageNumber uint64)
func (*MsgVersion) SetReceivedAt ¶
type NetAddress ¶
type NetAddress struct { // Last time the address was seen. Timestamp mstime.Time // IP address of the peer. IP net.IP // Port the peer is using. This is encoded in big endian on the appmessage // which differs from most everything else. Port uint16 }
NetAddress defines information about a peer on the network including the time it was last seen, the services it supports, its IP address, and port.
func NewNetAddress ¶
func NewNetAddress(addr *net.TCPAddr) *NetAddress
NewNetAddress returns a new NetAddress using the provided TCP address and supported services with defaults for the remaining fields.
func NewNetAddressIPPort ¶
func NewNetAddressIPPort(ip net.IP, port uint16) *NetAddress
NewNetAddressIPPort returns a new NetAddress using the provided IP, port, and supported services with defaults for the remaining fields.
func NewNetAddressTimestamp ¶
NewNetAddressTimestamp returns a new NetAddress using the provided timestamp, IP, port, and supported services. The timestamp is rounded to single millisecond precision.
func (NetAddress) String ¶
func (na NetAddress) String() string
func (*NetAddress) TCPAddress ¶
func (na *NetAddress) TCPAddress() *net.TCPAddr
TCPAddress converts the NetAddress to *net.TCPAddr
type NewBlockTemplateNotificationMessage ¶
type NewBlockTemplateNotificationMessage struct {
// contains filtered or unexported fields
}
NewBlockTemplateNotificationMessage is an appmessage corresponding to its respective RPC message
func NewNewBlockTemplateNotificationMessage ¶
func NewNewBlockTemplateNotificationMessage() *NewBlockTemplateNotificationMessage
NewNewBlockTemplateNotificationMessage returns an instance of the message
func (*NewBlockTemplateNotificationMessage) Command ¶
func (msg *NewBlockTemplateNotificationMessage) Command() MessageCommand
Command returns the protocol command string for the message
func (*NewBlockTemplateNotificationMessage) MessageNumber ¶
func (b *NewBlockTemplateNotificationMessage) MessageNumber() uint64
func (*NewBlockTemplateNotificationMessage) ReceivedAt ¶
func (*NewBlockTemplateNotificationMessage) SetMessageNumber ¶
func (b *NewBlockTemplateNotificationMessage) SetMessageNumber(messageNumber uint64)
func (*NewBlockTemplateNotificationMessage) SetReceivedAt ¶
type NotifyNewBlockTemplateRequestMessage ¶
type NotifyNewBlockTemplateRequestMessage struct {
// contains filtered or unexported fields
}
NotifyNewBlockTemplateRequestMessage is an appmessage corresponding to its respective RPC message
func NewNotifyNewBlockTemplateRequestMessage ¶
func NewNotifyNewBlockTemplateRequestMessage() *NotifyNewBlockTemplateRequestMessage
NewNotifyNewBlockTemplateRequestMessage returns an instance of the message
func (*NotifyNewBlockTemplateRequestMessage) Command ¶
func (msg *NotifyNewBlockTemplateRequestMessage) Command() MessageCommand
Command returns the protocol command string for the message
func (*NotifyNewBlockTemplateRequestMessage) MessageNumber ¶
func (b *NotifyNewBlockTemplateRequestMessage) MessageNumber() uint64
func (*NotifyNewBlockTemplateRequestMessage) ReceivedAt ¶
func (*NotifyNewBlockTemplateRequestMessage) SetMessageNumber ¶
func (b *NotifyNewBlockTemplateRequestMessage) SetMessageNumber(messageNumber uint64)
func (*NotifyNewBlockTemplateRequestMessage) SetReceivedAt ¶
type NotifyNewBlockTemplateResponseMessage ¶
type NotifyNewBlockTemplateResponseMessage struct { Error *RPCError // contains filtered or unexported fields }
NotifyNewBlockTemplateResponseMessage is an appmessage corresponding to its respective RPC message
func NewNotifyNewBlockTemplateResponseMessage ¶
func NewNotifyNewBlockTemplateResponseMessage() *NotifyNewBlockTemplateResponseMessage
NewNotifyNewBlockTemplateResponseMessage returns an instance of the message
func (*NotifyNewBlockTemplateResponseMessage) Command ¶
func (msg *NotifyNewBlockTemplateResponseMessage) Command() MessageCommand
Command returns the protocol command string for the message
func (*NotifyNewBlockTemplateResponseMessage) MessageNumber ¶
func (b *NotifyNewBlockTemplateResponseMessage) MessageNumber() uint64
func (*NotifyNewBlockTemplateResponseMessage) ReceivedAt ¶
func (*NotifyNewBlockTemplateResponseMessage) SetMessageNumber ¶
func (b *NotifyNewBlockTemplateResponseMessage) SetMessageNumber(messageNumber uint64)
func (*NotifyNewBlockTemplateResponseMessage) SetReceivedAt ¶
type RPCBlock ¶
type RPCBlock struct { Header *RPCBlockHeader VerboseData *RPCBlockVerboseData }
RPCBlock is a Metchaind block representation meant to be used over RPC
func DomainBlockToRPCBlock ¶
func DomainBlockToRPCBlock(block *external.DomainBlock) (*RPCBlock, *external.DomainBlock)
type RPCBlockHeader ¶
type RPCBlockHeader struct { Version uint32 Parents []*RPCBlockLevelParents HashMerkleRoot string AcceptedIDMerkleRoot string UTXOCommitment string Timestamp int64 Bits uint32 Nonce uint64 }
RPCBlockHeader is a Metchaind block header representation meant to be used over RPC
type RPCBlockLevelParents ¶
type RPCBlockLevelParents struct {
ParentHashes []string
}
RPCBlockLevelParents holds parent hashes for one block level
type RPCBlockVerboseData ¶
type RPCBlockVerboseData struct { Hash string Difficulty float64 SelectedParentHash string TransactionIDs []string IsHeaderOnly bool BlueScore uint64 ChildrenHashes []string MergeSetBluesHashes []string MergeSetRedsHashes []string IsChainBlock bool }
RPCBlockVerboseData holds verbose data about a block
type RPCError ¶
type RPCError struct {
Message string
}
RPCError represents an error arriving from the RPC
type RejectReason ¶
type RejectReason byte
RejectReason describes the reason why a block sent by SubmitBlock was rejected
const ( RejectReasonNone RejectReason = 0 RejectReasonBlockInvalid RejectReason = 1 RejectReasonIsInIBD RejectReason = 2 )
RejectReason constants Not using iota, since in the .proto file those are hardcoded
func (RejectReason) String ¶
func (rr RejectReason) String() string
type ServiceFlag ¶
type ServiceFlag uint64
const ( // SFNodeNetwork is a flag used to indicate a peer is a full node. SFNodeNetwork ServiceFlag = 1 << iota // SFNodeGetUTXO is a flag used to indicate a peer supports the // getutxos and utxos commands (BIP0064). SFNodeGetUTXO // SFNodeBloom is a flag used to indicate a peer supports bloom // filtering. SFNodeBloom // SFNodeXthin is a flag used to indicate a peer supports xthin blocks. SFNodeXthin // SFNodeBit5 is a flag used to indicate a peer supports a service // defined by bit 5. SFNodeBit5 // SFNodeCF is a flag used to indicate a peer supports committed // filters (CFs). SFNodeCF )
type SubmitBlockRequestMessage ¶
type SubmitBlockRequestMessage struct { Block *RPCBlock AllowNonDAABlocks bool // contains filtered or unexported fields }
func NewSubmitBlockRequestMessage ¶
func NewSubmitBlockRequestMessage(block *RPCBlock, allowNonDAABlocks bool) *SubmitBlockRequestMessage
NewSubmitBlockRequestMessage returns a instance of the message
func (*SubmitBlockRequestMessage) Command ¶
func (msg *SubmitBlockRequestMessage) Command() MessageCommand
Command returns the protocol command string for the message
func (*SubmitBlockRequestMessage) MessageNumber ¶
func (b *SubmitBlockRequestMessage) MessageNumber() uint64
func (*SubmitBlockRequestMessage) ReceivedAt ¶
func (*SubmitBlockRequestMessage) SetMessageNumber ¶
func (b *SubmitBlockRequestMessage) SetMessageNumber(messageNumber uint64)
func (*SubmitBlockRequestMessage) SetReceivedAt ¶
type SubmitBlockResponseMessage ¶
type SubmitBlockResponseMessage struct { RejectReason RejectReason Error *RPCError // contains filtered or unexported fields }
SubmitBlockResponseMessage is an appmessage corresponding to its respective RPC message
func NewSubmitBlockResponseMessage ¶
func NewSubmitBlockResponseMessage() *SubmitBlockResponseMessage
NewSubmitBlockResponseMessage returns an instance of the message
func (*SubmitBlockResponseMessage) Command ¶
func (msg *SubmitBlockResponseMessage) Command() MessageCommand
Command returns the protocol command string for the message
func (*SubmitBlockResponseMessage) MessageNumber ¶
func (b *SubmitBlockResponseMessage) MessageNumber() uint64
func (*SubmitBlockResponseMessage) ReceivedAt ¶
func (*SubmitBlockResponseMessage) SetMessageNumber ¶
func (b *SubmitBlockResponseMessage) SetMessageNumber(messageNumber uint64)
func (*SubmitBlockResponseMessage) SetReceivedAt ¶
Source Files
¶
- base_message.go
- commands.go
- domainconvert.go
- error.go
- get_block_dag_info.go
- message.go
- messageaddress_request.go
- notify_new_block_template_notofication_message.go
- p2p.go
- p2p_message_addresses.go
- p2p_message_verAck.go
- p2p_messagereject.go
- p2p_messageversion.go
- p2p_ready.go
- protocol.go
- rpc_estimate_network_hashes_per_second.go
- rpc_get_balance_by_address.go
- rpc_get_block_template.go
- rpc_get_info.go
- rpc_notify_new_block_added.go
- rpc_submit_block.go