message

package
v0.0.0-...-5d360bc Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2017 License: MIT Imports: 3 Imported by: 0

README

Message


  • 用于不同节点传递消息
  • 目前用于:
    • 发起交易,传递给其他节点
    • 收到交易,验证交易合法,发回确认消息
    • 打包Block,广播给其他及诶按
    • 收到Block,验证POW合法, 发回确认写入消息

Documentation

Index

Constants

View Source
const (
	MessageTypeSendTransaction    = 1
	MessageTypeSendBlock          = 2
	MessageTypeConfirmTransaction = 3
	MessageTypeConfirmBlock       = 4
	MessageTypePort               = 9

	MessageTypeSize = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Type  int
	Data  []byte
	Reply chan Message // Message到达之后,可能需要根据该Channel返回确认消息
}

func NewMessage

func NewMessage(messageType int) (*Message, error)

func (*Message) MarshalBinary

func (m *Message) MarshalBinary() []byte

func (*Message) UnmarshalBinary

func (m *Message) UnmarshalBinary(data []byte)

Jump to

Keyboard shortcuts

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