1 package wire
2 3 import (
4 "fmt"
5 "io"
6 )
7 8 // MsgFilterClear implements the Message interface and represents a bitcoin filterclear message which is used to reset a
9 // Bloom filter. This message was not added until protocol version BIP0037Version and has no payload.
10 type MsgFilterClear struct{}
11 12 // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface
13 // implementation.
14 func (msg *MsgFilterClear) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) (e error) {
15 if pver < BIP0037Version {
16 str := fmt.Sprintf("filterclear message invalid for protocol "+
17 "version %d", pver,
18 )
19 return messageError("MsgFilterClear.BtcDecode", str)
20 }
21 return nil
22 }
23 24 // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface
25 // implementation.
26 func (msg *MsgFilterClear) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) (e error) {
27 if pver < BIP0037Version {
28 str := fmt.Sprintf("filterclear message invalid for protocol "+
29 "version %d", pver,
30 )
31 return messageError("MsgFilterClear.BtcEncode", str)
32 }
33 return nil
34 }
35 36 // Command returns the protocol command string for the message. This is part of the Message interface implementation.
37 func (msg *MsgFilterClear) Command() string {
38 return CmdFilterClear
39 }
40 41 // MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message
42 // interface implementation.
43 func (msg *MsgFilterClear) MaxPayloadLength(pver uint32) uint32 {
44 return 0
45 }
46 47 // NewMsgFilterClear returns a new bitcoin filterclear message that conforms to the Message interface. See
48 // MsgFilterClear for details.
49 func NewMsgFilterClear() *MsgFilterClear {
50 return &MsgFilterClear{}
51 }
52