diff --git a/wire/message.go b/wire/message.go index adabd348..0e376422 100644 --- a/wire/message.go +++ b/wire/message.go @@ -74,6 +74,7 @@ const ( CmdCmpctBlock = "cmpctblock" CmdGetBlockTxns = "getblocktxn" CmdBlockTxns = "blocktxn" + CmdSendAddrV2 = "sendaddrv2" ) // MessageEncoding represents the wire message encoding format to be used. @@ -114,6 +115,9 @@ func makeEmptyMessage(command string) (Message, error) { case CmdVerAck: msg = &MsgVerAck{} + case CmdSendAddrV2: + msg = &MsgSendAddrV2{} + case CmdXVerAck: msg = &MsgXVerAck{} diff --git a/wire/msgsendaddrv2.go b/wire/msgsendaddrv2.go new file mode 100644 index 00000000..f76c6fa6 --- /dev/null +++ b/wire/msgsendaddrv2.go @@ -0,0 +1,45 @@ +// Copyright (c) 2013-2015 The btcsuite developers +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package wire + +import ( + "io" +) + +// MsgSendAddrV2 defines a bitcoin sendaddrv2 message which is used for a peer to +// signal support for receiving addrv2 messages (BIP155). It implements the Message interface. +// +// This message has no payload. +type MsgSendAddrV2 struct{} + +// BchDecode decodes r using the bitcoin protocol encoding into the receiver. +// This is part of the Message interface implementation. +func (msg *MsgSendAddrV2) BchDecode(r io.Reader, pver uint32, enc MessageEncoding) error { + return nil +} + +// BchEncode encodes the receiver to w using the bitcoin protocol encoding. +// This is part of the Message interface implementation. +func (msg *MsgSendAddrV2) BchEncode(w io.Writer, pver uint32, enc MessageEncoding) error { + return nil +} + +// Command returns the protocol command string for the message. This is part +// of the Message interface implementation. +func (msg *MsgSendAddrV2) Command() string { + return CmdSendAddrV2 +} + +// MaxPayloadLength returns the maximum length the payload can be for the +// receiver. This is part of the Message interface implementation. +func (msg *MsgSendAddrV2) MaxPayloadLength(pver uint32) uint32 { + return 0 +} + +// NewMsgSendAddrV2 returns a new bitcoin sendaddrv2 message that conforms to the +// Message interface. +func NewMsgSendAddrV2() *MsgSendAddrV2 { + return &MsgSendAddrV2{} +}