code: func (msg *MsgCFHeaders) BtcEncode(w io.Writer, pver uint32, _ MessageEncoding) error {
  	// Write filter type
  	err := writeElement(w, msg.FilterType)
  	if err != nil {
  		return err
  	}
  
  	// Write stop hash
  	err = writeElement(w, msg.StopHash)
  	if err != nil {
  		return err
  	}
  
  	// Write prev filter header
  	err = writeElement(w, msg.PrevFilterHeader)
  	if err != nil {
  		return err
  	}
  
  	// Limit to max committed headers per message.
  	count := len(msg.FilterHashes)
  	if count > MaxCFHeadersPerMsg {
  		str := fmt.Sprintf("too many committed filter headers for "+
  			"message [count %v, max %v]", count,
  			MaxBlockHeadersPerMsg)
  		return messageError("MsgCFHeaders.BtcEncode", str)
  	}
  
  	err = WriteVarInt(w, pver, uint64(count))
  	if err != nil {
  		return err
  	}
  
  	for _, cfh := range msg.FilterHashes {
  		err := writeElement(w, cfh)
  		if err != nil {
  			return err
  		}
  	}
  
  	return nil
  }
docs: // BtcEncode encodes the receiver to w using the bitcoin protocol encoding.
  // This is part of the Message interface implementation.