github.com/lbryio/lbcd@v0.22.119/wire/msgmempool.go (about) 1 // Copyright (c) 2013-2015 The btcsuite developers 2 // Use of this source code is governed by an ISC 3 // license that can be found in the LICENSE file. 4 5 package wire 6 7 import ( 8 "fmt" 9 "io" 10 ) 11 12 // MsgMemPool implements the Message interface and represents a bitcoin mempool 13 // message. It is used to request a list of transactions still in the active 14 // memory pool of a relay. 15 // 16 // This message has no payload and was not added until protocol versions 17 // starting with BIP0035Version. 18 type MsgMemPool struct{} 19 20 // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 21 // This is part of the Message interface implementation. 22 func (msg *MsgMemPool) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error { 23 if pver < BIP0035Version { 24 str := fmt.Sprintf("mempool message invalid for protocol "+ 25 "version %d", pver) 26 return messageError("MsgMemPool.BtcDecode", str) 27 } 28 29 return nil 30 } 31 32 // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 33 // This is part of the Message interface implementation. 34 func (msg *MsgMemPool) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error { 35 if pver < BIP0035Version { 36 str := fmt.Sprintf("mempool message invalid for protocol "+ 37 "version %d", pver) 38 return messageError("MsgMemPool.BtcEncode", str) 39 } 40 41 return nil 42 } 43 44 // Command returns the protocol command string for the message. This is part 45 // of the Message interface implementation. 46 func (msg *MsgMemPool) Command() string { 47 return CmdMemPool 48 } 49 50 // MaxPayloadLength returns the maximum length the payload can be for the 51 // receiver. This is part of the Message interface implementation. 52 func (msg *MsgMemPool) MaxPayloadLength(pver uint32) uint32 { 53 return 0 54 } 55 56 // NewMsgMemPool returns a new bitcoin pong message that conforms to the Message 57 // interface. See MsgPong for details. 58 func NewMsgMemPool() *MsgMemPool { 59 return &MsgMemPool{} 60 }