github.com/BlockABC/godash@v0.0.0-20191112120524-f4aa3a32c566/wire/msgmempool.go (about)

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