예제 #1
0
  @Override
  JSONStreamAware processRequest(HttpServletRequest req) throws NxtException {

    String transactionBytes = Convert.emptyToNull(req.getParameter("transactionBytes"));
    String transactionJSON = Convert.emptyToNull(req.getParameter("transactionJSON"));
    String prunableAttachmentJSON = Convert.emptyToNull(req.getParameter("prunableAttachmentJSON"));

    Transaction transaction =
        ParameterParser.parseTransaction(transactionJSON, transactionBytes, prunableAttachmentJSON)
            .build();
    JSONObject response = JSONData.unconfirmedTransaction(transaction);
    try {
      transaction.validate();
    } catch (NxtException.ValidationException | RuntimeException e) {
      Logger.logDebugMessage(e.getMessage(), e);
      response.put("validate", false);
      JSONData.putException(response, e, "Invalid transaction");
    }
    response.put("verify", transaction.verifySignature());
    return response;
  }