code: func (msg *MsgAlert) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error {
  	var err error
  	var serializedpayload []byte
  	if msg.Payload != nil {
  		// try to Serialize Payload if possible
  		r := new(bytes.Buffer)
  		err = msg.Payload.Serialize(r, pver)
  		if err != nil {
  			// Serialize failed - ignore & fallback
  			// to SerializedPayload
  			serializedpayload = msg.SerializedPayload
  		} else {
  			serializedpayload = r.Bytes()
  		}
  	} else {
  		serializedpayload = msg.SerializedPayload
  	}
  	slen := uint64(len(serializedpayload))
  	if slen == 0 {
  		return messageError("MsgAlert.BtcEncode", "empty serialized payload")
  	}
  	err = WriteVarBytes(w, pver, serializedpayload)
  	if err != nil {
  		return err
  	}
  	return WriteVarBytes(w, pver, msg.Signature)
  }
docs: // BtcEncode encodes the receiver to w using the bitcoin protocol encoding.
  // This is part of the Message interface implementation.