Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Add unimplemented private transaction type
Browse files Browse the repository at this point in the history
  • Loading branch information
iikirilov authored and Puneetha17 committed Feb 21, 2019
1 parent ad1fb16 commit b1d9521
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy;

import static java.nio.charset.StandardCharsets.UTF_8;
import static tech.pegasys.pantheon.ethereum.jsonrpc.JsonRpcErrorConverter.convertTransactionInvalidReason;

import tech.pegasys.pantheon.ethereum.core.Transaction;
Expand Down Expand Up @@ -77,6 +78,13 @@ public JsonRpcResponse response(final JsonRpcRequest request) {
return new JsonRpcErrorResponse(request.getId(), JsonRpcError.INVALID_PARAMS);
}

if (!privateTransaction
.getRestriction()
.equals(BytesValue.wrap("unrestricted".getBytes(UTF_8)))) {
return new JsonRpcErrorResponse(
request.getId(), JsonRpcError.UNIMPLEMENTED_PRIVATE_TRANSACTION_TYPE);
}

final Transaction transaction;
try {
transaction = handlePrivateTransaction(privateTransaction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public enum JsonRpcError {
UNAUTHORIZED(-40100, "Unauthorized"),

// Private transaction errors
ENCLAVE_IS_DOWN(-32000, "Enclave is down");
ENCLAVE_IS_DOWN(-50100, "Enclave is down"),
UNIMPLEMENTED_PRIVATE_TRANSACTION_TYPE(-50100, "Unimplemented private transaction type");

private final int code;
private final String message;
Expand Down

0 comments on commit b1d9521

Please sign in to comment.