Merge pull request #1670 from breez/sendaddrv2

Add support for receiving sendaddrv2 message from a peer
This commit is contained in:
Olaoluwa Osuntokun 2020-12-07 19:32:08 -08:00 committed by GitHub
commit 6bd4c64a54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 0 deletions

View file

@ -57,6 +57,7 @@ const (
CmdCFilter = "cfilter" CmdCFilter = "cfilter"
CmdCFHeaders = "cfheaders" CmdCFHeaders = "cfheaders"
CmdCFCheckpt = "cfcheckpt" CmdCFCheckpt = "cfcheckpt"
CmdSendAddrV2 = "sendaddrv2"
) )
// MessageEncoding represents the wire message encoding format to be used. // MessageEncoding represents the wire message encoding format to be used.
@ -99,6 +100,9 @@ func makeEmptyMessage(command string) (Message, error) {
case CmdVerAck: case CmdVerAck:
msg = &MsgVerAck{} msg = &MsgVerAck{}
case CmdSendAddrV2:
msg = &MsgSendAddrV2{}
case CmdGetAddr: case CmdGetAddr:
msg = &MsgGetAddr{} msg = &MsgGetAddr{}

42
wire/msgsendaddrv2.go Normal file
View file

@ -0,0 +1,42 @@
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{}
// BtcDecode decodes r using the bitcoin protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgSendAddrV2) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error {
return nil
}
// BtcEncode encodes the receiver to w using the bitcoin protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgSendAddrV2) BtcEncode(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{}
}