code: func messageToHex(msg wire.Message) (string, error) {
  	var buf bytes.Buffer
  	if err := msg.BtcEncode(&buf, maxProtocolVersion, wire.WitnessEncoding); err != nil {
  		context := fmt.Sprintf("Failed to encode msg of type %T", msg)
  		return "", internalRPCError(err.Error(), context)
  	}
  
  	return hex.EncodeToString(buf.Bytes()), nil
  }
docs: // messageToHex serializes a message to the wire protocol encoding using the
  // latest protocol version and returns a hex-encoded string of the result.