diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/priv/PrivGetPrivacyPrecompileAddress.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/priv/PrivGetPrivacyPrecompileAddress.java index 4f86728ce7..4eda2de8a4 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/priv/PrivGetPrivacyPrecompileAddress.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/priv/PrivGetPrivacyPrecompileAddress.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv; +import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.ethereum.core.PrivacyParameters; import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; @@ -40,7 +41,8 @@ public class PrivGetPrivacyPrecompileAddress implements JsonRpcMethod { public JsonRpcResponse response(final JsonRpcRequest request) { if (privacyEnabled) { - return new JsonRpcSuccessResponse(request.getId(), privacyAddress); + return new JsonRpcSuccessResponse( + request.getId(), Address.privacyPrecompiled(privacyAddress).toString()); } else { return new JsonRpcErrorResponse(request.getId(), JsonRpcError.PRIVACY_NOT_ENABLED); } diff --git a/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/priv/PrivGetPrivacyPrecompileAddressTest.java b/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/priv/PrivGetPrivacyPrecompileAddressTest.java index 4c98e113d8..214907f72d 100644 --- a/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/priv/PrivGetPrivacyPrecompileAddressTest.java +++ b/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/priv/PrivGetPrivacyPrecompileAddressTest.java @@ -16,6 +16,7 @@ import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.ethereum.core.PrivacyParameters; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcError; @@ -28,12 +29,13 @@ import org.junit.Test; public class PrivGetPrivacyPrecompileAddressTest { - private final Integer privacyAddress = 127; + private final int rawPrivacyAddress = Address.PRIVACY; + private final String privacyAddress = Address.privacyPrecompiled(rawPrivacyAddress).toString(); private final PrivacyParameters privacyParameters = mock(PrivacyParameters.class); @Test public void verifyPrivacyPrecompileAddress() { - when(privacyParameters.getPrivacyAddress()).thenReturn(privacyAddress); + when(privacyParameters.getPrivacyAddress()).thenReturn(rawPrivacyAddress); when(privacyParameters.isEnabled()).thenReturn(true); final PrivGetPrivacyPrecompileAddress privGetPrivacyPrecompileAddress = @@ -50,7 +52,7 @@ public class PrivGetPrivacyPrecompileAddressTest { @Test public void verifyErrorPrivacyDisabled() { - when(privacyParameters.getPrivacyAddress()).thenReturn(privacyAddress); + when(privacyParameters.getPrivacyAddress()).thenReturn(rawPrivacyAddress); when(privacyParameters.isEnabled()).thenReturn(false); final PrivGetPrivacyPrecompileAddress privGetPrivacyPrecompileAddress =