From 9f1d867f7ef7a70ae7d497e4571346c9b3da6849 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 9 Oct 2020 20:24:52 +0100 Subject: [PATCH] java: change Host.account_exists to return boolean --- bindings/java/c/host.c | 4 ++-- bindings/java/java/src/main/java/org/ethereum/evmc/Host.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bindings/java/c/host.c b/bindings/java/c/host.c index 090b35768..3d691efc3 100644 --- a/bindings/java/c/host.c +++ b/bindings/java/c/host.c @@ -52,7 +52,7 @@ static void CopyFromByteBuffer(JNIEnv* jenv, jobject src, void* dst, size_t size static bool account_exists_fn(struct evmc_host_context* context, const evmc_address* address) { const char java_method_name[] = "account_exists"; - const char java_method_signature[] = "(I[B)I"; + const char java_method_signature[] = "(I[B)Z"; assert(context != NULL); JNIEnv* jenv = attach(); @@ -70,7 +70,7 @@ static bool account_exists_fn(struct evmc_host_context* context, const evmc_addr jbyteArray jaddress = CopyDataToJava(jenv, address, sizeof(struct evmc_address)); // call java method - jint jresult = (*jenv)->CallStaticIntMethod(jenv, host_class, method, context->index, jaddress); + jboolean jresult = (*jenv)->CallStaticIntMethod(jenv, host_class, method, context->index, jaddress); return jresult != 0; } diff --git a/bindings/java/java/src/main/java/org/ethereum/evmc/Host.java b/bindings/java/java/src/main/java/org/ethereum/evmc/Host.java index 21a5df080..35a67d0f8 100644 --- a/bindings/java/java/src/main/java/org/ethereum/evmc/Host.java +++ b/bindings/java/java/src/main/java/org/ethereum/evmc/Host.java @@ -17,12 +17,12 @@ */ final class Host { /** Check account existence callback function. */ - static int account_exists(int context_index, byte[] address) { + static boolean account_exists(int context_index, byte[] address) { HostContext context = requireNonNull( getContext(context_index), "HostContext does not exist for context_index: " + context_index); - return context.accountExists(address) ? 1 : 0; + return context.accountExists(address); } /** Get storage callback function. */