Documentation ¶
Index ¶
Constants ¶
const ( CmdVersion = "version" CmdGetAddr = "getaddr" CmdAddr = "addr" CmdGetBlocks = "getblocks" CmdInv = "inv" CmdGetData = "getdata" CmdNotFound = "notfound" CmdBlock = "block" CmdTx = "tx" CmdGetHeaders = "getheaders" CmdHeaders = "headers" CmdAlert = "alert" CmdMemPool = "mempool" CmdMerkleBlock = "merkleblock" CmdSendHeaders = "sendheaders" )
const ( InvTypeError = "ERROR" InvTypeTx = "MSG_TX" InvTypeBlock = "MSG_BLOCK" )
Map of service flags back to their constant names for pretty printing.
const MaxAddrPerMsg = 1000
MaxAddrPerMsg is the maximum number of addresses that can be in a single bitcoin addr message (MsgAddr).
const MaxBlocksPerMsg = 500
MaxBlocksPerMsg is the max number of block hashes allowed per message.
const (
// MaxInvPerMsg is the maximum number of inventory vectors that can be in a single inv message.
MaxInvPerMsg = 50000
)
const ( // ProtocolVersion is the latest protocol version this package supports. ProtocolVersion uint32 = 10000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageError ¶
type MessageError struct { Func string // Function name Description string // Human readable description of the issue }
func (*MessageError) Error ¶
func (e *MessageError) Error() string
Error satisfies the error interface and prints human-readable errors.
type MsgAddr ¶
type MsgAddr struct { NetMessage AddrList []string }
func (*MsgAddr) AddAddress ¶
AddAddress adds a known active peer to the message.
func (*MsgAddr) AddAddresses ¶
AddAddresses adds multiple known active peers to the message.
func (*MsgAddr) ClearAddresses ¶
func (msg *MsgAddr) ClearAddresses()
ClearAddresses removes all addresses from the message.
type MsgGetAddr ¶
type MsgGetAddr struct {
NetMessage
}
func (*MsgGetAddr) Command ¶
func (msg *MsgGetAddr) Command() string
Command returns the protocol command string
type MsgGetBlocks ¶
type MsgGetBlocks struct { NetMessage HashStop hashx.Hash }
func NewMsgGetBlocks ¶
func NewMsgGetBlocks(hashStop hashx.Hash) *MsgGetBlocks
NewMsgGetBlocks returns a new getblocks message
func (*MsgGetBlocks) Command ¶
func (msg *MsgGetBlocks) Command() string
type MsgGetData ¶
type MsgGetData struct { NetMessage InvList []*InvInfo }
func NewMsgGetData ¶
func NewMsgGetData() *MsgGetData
func (*MsgGetData) AddInvInfo ¶
func (msg *MsgGetData) AddInvInfo(iv *InvInfo) error
AddInvInfo adds an inventory to the message.
func (*MsgGetData) Command ¶
func (msg *MsgGetData) Command() string
type MsgInv ¶
type MsgInv struct { NetMessage InvList []*InvInfo }
func (*MsgInv) AddInvInfo ¶
AddInvVect adds an inventory info to the message.
type MsgTx ¶
type MsgTx struct { NetMessage Tx *chain.Transaction }
func NewMsgTx ¶
func NewMsgTx(tx *chain.Transaction) *MsgTx
type MsgVersion ¶
type MsgVersion struct { NetMessage ProtocolVersion int32 // Time the message was generated. This is encoded as an int64 on the wire. Timestamp time.Time // Last block Height seen by the generator of the version message. LastBlockHeight int32 // Last block hash seen by the generator of the version message. LastBlockHash []byte // Last block prev hash seen by the generator of the version message. LastBlockPrevHash []byte }
func NewMsgVersion ¶
func NewMsgVersion(lastBlockHeight int32, lastBlockHash, lastBlockPrevHash []byte) *MsgVersion
func (*MsgVersion) Command ¶
func (msg *MsgVersion) Command() string
Command returns the protocol command string
type NetMessage ¶
func (*NetMessage) GetFromAddr ¶
func (m *NetMessage) GetFromAddr() string
func (*NetMessage) SetFromAddr ¶
func (m *NetMessage) SetFromAddr(addr string)