Skip to content

Commit

Permalink
return enclave key instead of private transaction hash (#53)
Browse files Browse the repository at this point in the history
Signed-off-by: Ivaylo Kirilov <[email protected]>
Signed-off-by: Lucas Saldanha <[email protected]>
  • Loading branch information
iikirilov authored and lucassaldanha committed Sep 25, 2019
1 parent 1937f12 commit 83ad8e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.privacy.PrivateTransaction;
import org.hyperledger.besu.ethereum.privacy.PrivateTransactionHandler;
import org.hyperledger.besu.util.bytes.BytesValues;

public class PrivDistributeRawTransaction extends AbstractSendTransaction implements JsonRpcMethod {

Expand Down Expand Up @@ -72,6 +73,8 @@ public JsonRpcResponse response(final JsonRpcRequest request) {
request,
privateTransaction,
privacyGroupId,
() -> new JsonRpcSuccessResponse(request.getId(), privateTransaction.hash().toString()));
() ->
new JsonRpcSuccessResponse(
request.getId(), BytesValues.fromBase64(enclaveKey).toString()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.hyperledger.besu.ethereum.mainnet.ValidationResult;
import org.hyperledger.besu.ethereum.privacy.PrivateTransaction;
import org.hyperledger.besu.ethereum.privacy.PrivateTransactionHandler;
import org.hyperledger.besu.util.bytes.BytesValues;

import org.junit.Before;
import org.junit.Test;
Expand All @@ -47,7 +48,7 @@ public class PrivDistributeRawTransactionTest {
+ "200e885ff29e973e2576b6600181d1b0a2b5294e30d9be4a1981"
+ "ffb33a0b8c8a72657374726963746564";

final String MOCK_ORION_KEY = "";
final String MOCK_ORION_KEY = "93Ky7lXwFkMc7+ckoFgUMku5bpr9tz4zhmWmk9RlNng=";
private final String MOCK_PRIVACY_GROUP = "";

@Mock private TransactionPool transactionPool;
Expand Down Expand Up @@ -82,7 +83,7 @@ public void validTransactionHashReturnedAfterDistribute() throws Exception {

final JsonRpcResponse expectedResponse =
new JsonRpcSuccessResponse(
request.getId(), "0x34d3db0593e0dad50104cc575db154b6e1a57ff3fc0354b2df2f25c8f21aca66");
request.getId(), BytesValues.fromBase64(MOCK_ORION_KEY).toString());

final JsonRpcResponse actualResponse = method.response(request);

Expand Down

0 comments on commit 83ad8e6

Please sign in to comment.