github.com/dashpay/godash@v0.0.0-20160726055534-e038a21e0e3d/wire/msgfilterclear.go (about)

     1  // Copyright (c) 2014-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  // MsgFilterClear implements the Message interface and represents a bitcoin
    14  // filterclear message which is used to reset a Bloom filter.
    15  //
    16  // This message was not added until protocol version BIP0037Version and has
    17  // no payload.
    18  type MsgFilterClear 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 *MsgFilterClear) BtcDecode(r io.Reader, pver uint32) error {
    23  	if pver < BIP0037Version {
    24  		str := fmt.Sprintf("filterclear message invalid for protocol "+
    25  			"version %d", pver)
    26  		return messageError("MsgFilterClear.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 *MsgFilterClear) BtcEncode(w io.Writer, pver uint32) error {
    35  	if pver < BIP0037Version {
    36  		str := fmt.Sprintf("filterclear message invalid for protocol "+
    37  			"version %d", pver)
    38  		return messageError("MsgFilterClear.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 *MsgFilterClear) Command() string {
    47  	return CmdFilterClear
    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 *MsgFilterClear) MaxPayloadLength(pver uint32) uint32 {
    53  	return 0
    54  }
    55  
    56  // NewMsgFilterClear returns a new bitcoin filterclear message that conforms to the Message
    57  // interface.  See MsgFilterClear for details.
    58  func NewMsgFilterClear() *MsgFilterClear {
    59  	return &MsgFilterClear{}
    60  }