1 // Copyright (c) 2016 The btcsuite developers
2 // Use of this source code is governed by an ISC
3 // license that can be found in the LICENSE file.
12 // MsgFeeFilter implements the Message interface and represents a bitcoin
13 // feefilter message. It is used to request the receiving peer does not
14 // announce any transactions below the specified minimum fee rate.
16 // This message was not added until protocol versions starting with
18 type MsgFeeFilter struct {
22 // BtcDecode decodes r using the bitcoin protocol encoding into the receiver.
23 // This is part of the Message interface implementation.
24 func (msg *MsgFeeFilter) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error {
25 if pver < FeeFilterVersion {
26 str := fmt.Sprintf("feefilter message invalid for protocol "+
28 return messageError("MsgFeeFilter.BtcDecode", str)
31 return readElement(r, &msg.MinFee)
34 // BtcEncode encodes the receiver to w using the bitcoin protocol encoding.
35 // This is part of the Message interface implementation.
36 func (msg *MsgFeeFilter) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error {
37 if pver < FeeFilterVersion {
38 str := fmt.Sprintf("feefilter message invalid for protocol "+
40 return messageError("MsgFeeFilter.BtcEncode", str)
43 return writeElement(w, msg.MinFee)
46 // Command returns the protocol command string for the message. This is part
47 // of the Message interface implementation.
48 func (msg *MsgFeeFilter) Command() string {
52 // MaxPayloadLength returns the maximum length the payload can be for the
53 // receiver. This is part of the Message interface implementation.
54 func (msg *MsgFeeFilter) MaxPayloadLength(pver uint32) uint32 {
58 // NewMsgFeeFilter returns a new bitcoin feefilter message that conforms to
59 // the Message interface. See MsgFeeFilter for details.
60 func NewMsgFeeFilter(minfee int64) *MsgFeeFilter {