message

package
v0.0.0-...-640f24c Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2018 License: LGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTP_INFO_FLAG = 0
)

Variables

View Source
var LastInvHash common.Uint256

Functions

func GetHeadersFromHash

func GetHeadersFromHash(startHash common.Uint256, stopHash common.Uint256) ([]types.Header, uint32, error)

func HandleNodeMsg

func HandleNodeMsg(node protocol.Noder, buf []byte, len int) error

func LocateMsgHdr

func LocateMsgHdr(buf []byte) []byte

func MsgType

func MsgType(buf []byte) (string, error)

func NewAddrs

func NewAddrs(nodeaddrs []protocol.NodeAddr, count uint64) ([]byte, error)

func NewBlock

func NewBlock(bk *types.Block) ([]byte, error)

func NewBlockFromHash

func NewBlockFromHash(hash common.Uint256) (*types.Block, error)

func NewBlocksReq

func NewBlocksReq(n protocol.Noder) ([]byte, error)

func NewConsensus

func NewConsensus(cp *ConsensusPayload) ([]byte, error)

func NewHeaders

func NewHeaders(headers []types.Header, count uint32) ([]byte, error)

func NewHeadersReq

func NewHeadersReq() ([]byte, error)

func NewInv

func NewInv(inv *InvPayload) ([]byte, error)

func NewMsg

func NewMsg(t string, n protocol.Noder) ([]byte, error)

func NewNotFound

func NewNotFound(hash common.Uint256) ([]byte, error)

func NewPingMsg

func NewPingMsg() ([]byte, error)

func NewPongMsg

func NewPongMsg() ([]byte, error)

func NewTxn

func NewTxn(txn *types.Transaction) ([]byte, error)

func NewTxnFromHash

func NewTxnFromHash(hash common.Uint256) (*types.Transaction, error)

func NewVerack

func NewVerack() ([]byte, error)

func NewVersion

func NewVersion(n protocol.Noder) ([]byte, error)

func PayloadLen

func PayloadLen(buf []byte) int

func ReqBlkData

func ReqBlkData(node protocol.Noder, hash common.Uint256) error

func SendMsgSyncHeaders

func SendMsgSyncHeaders(node protocol.Noder)

func ValidMsgHdr

func ValidMsgHdr(buf []byte) bool

Types

type ConsensusPayload

type ConsensusPayload struct {
	Version         uint32
	PrevHash        common.Uint256
	Height          uint32
	BookkeeperIndex uint16
	Timestamp       uint32
	Data            []byte
	Owner           keypair.PublicKey
	Signature       []byte
	// contains filtered or unexported fields
}

func (*ConsensusPayload) Deserialize

func (cp *ConsensusPayload) Deserialize(r io.Reader) error

func (*ConsensusPayload) DeserializeUnsigned

func (cp *ConsensusPayload) DeserializeUnsigned(r io.Reader) error

func (*ConsensusPayload) GetMessage

func (cp *ConsensusPayload) GetMessage() []byte

func (*ConsensusPayload) Hash

func (cp *ConsensusPayload) Hash() common.Uint256

func (*ConsensusPayload) InvertoryType

func (cp *ConsensusPayload) InvertoryType() common.InventoryType

func (*ConsensusPayload) Serialize

func (cp *ConsensusPayload) Serialize(w io.Writer) error

func (*ConsensusPayload) SerializeUnsigned

func (cp *ConsensusPayload) SerializeUnsigned(w io.Writer) error

func (*ConsensusPayload) ToArray

func (cp *ConsensusPayload) ToArray() []byte

func (*ConsensusPayload) Type

func (*ConsensusPayload) Verify

func (cp *ConsensusPayload) Verify() error

type Inv

type Inv struct {
	Hdr msgHdr
	P   InvPayload
}

func (*Inv) Deserialization

func (msg *Inv) Deserialization(p []byte) error

func (Inv) Handle

func (msg Inv) Handle(node protocol.Noder) error

func (Inv) Serialization

func (msg Inv) Serialization() ([]byte, error)

func (Inv) Verify

func (msg Inv) Verify(buf []byte) error

type InvPayload

type InvPayload struct {
	InvType common.InventoryType
	Cnt     uint32
	Blk     []byte
}

func GetInvFromBlockHash

func GetInvFromBlockHash(starthash common.Uint256, stophash common.Uint256) (*InvPayload, error)

func NewInvPayload

func NewInvPayload(invType common.InventoryType, count uint32, msg []byte) *InvPayload

func (*InvPayload) Serialization

func (msg *InvPayload) Serialization(w io.Writer)

type Messager

type Messager interface {
	Verify([]byte) error
	Serialization() ([]byte, error)
	Deserialization([]byte) error
	Handle(protocol.Noder) error
}

func AllocMsg

func AllocMsg(t string, length int) Messager

Alloc different message structure @t the message name or type @len the message length only valid for varible length structure

Return: @messager the messager interface @error error code FixMe fix the ugly multiple return.

Jump to

Keyboard shortcuts

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